Changes between Version 4 and Version 5 of RowLevelPermissionsDeveloper
- Timestamp:
- Nov 23, 2006, 10:10:37 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RowLevelPermissionsDeveloper
v4 v5 1 [[TOC(inline)]] 1 == Row-level permissions model == 2 2 3 == Row Level Permissions Model == 4 5 Row Level Permissions uses generic relations to decrease the number of tables to only one. The generic relations allow us to create row level permissions with any instance of any model and connect it to an "owner" object. To allow more freedom, the owner object is also a generic relation. This means that you can use your own models as an owner of a row level permission. The actual model code is below: 3 The row-level permissions system uses generic relations to decrease the number of tables to only one. The generic relations allow us to create row-level permissions with any instance of any model and connect it to an "owner" object. To allow more freedom, the owner object is also a generic relation. This means that you can use your own models as an owner of a row-level permission. The actual model code is below: 6 4 7 5 {{{ … … 26 24 }}} 27 25 28 This does not modify the current permissions table at all, and can be layered on top of it if the developer wishes to but it can be ignored easily.26 This does not modify the current permissions table at all, and can be layered on top of it if the developer wishes to but it can be ignored easily. 29 27 30 == How Row Permissions Are Enabled ==28 == How row permissions are enabled == 31 29 32 Row permissions are enabled using the meta class, please see RowLevelPermissions for more information on how to enable them. How this is done is in django.db.models.base.ModelBase under __new__is the following snippet:30 Row permissions are enabled using the meta class, please see RowLevelPermissions for more information on how to enable them. How this is done is in django.db.models.base.ModelBase under {{{__new__}}} is the following snippet: 33 31 34 32 {{{ … … 40 38 }}} 41 39 42 In django.db.models.options.Options it has been modified to set row_level_permissionsas disabled by default.40 {{{django.db.models.options.Options}}} has been modified to set {{{row_level_permissions}}} as disabled by default. 43 41 44 == Owner Objects ==42 == Owner objects == 45 43 46 At this current point of time, you can set up an owner by including the following relation: 44 Currently, you can set up an owner by including the following relation: 45 47 46 {{{ 48 47 #!python 49 ...50 48 row_level_permissions_owned = models.GenericRelation(RowLevelPermission, object_id_field="owner_id", content_model_field="owner_ct", related_name="owner") 51 ...52 49 }}} 53 50 54 I might be changing this around in the near future, but I only expect it to be used a few times I don't see a large need to make this a similiar process to the enabling of rowlevel permissions on objects. Please give feedback if you think otherwise.51 I might be changing this around in the near future, but I only expect it to be used a few times, and I don't see a large need to make this a similiar process to the enabling of row-level permissions on objects. Please give feedback if you think otherwise. 55 52 56 == Checking of Row Level Permissions ==53 == Checking of row-level permissions == 57 54 58 55 Checking of RLP are done in the following order: User RLP->Group RLP->User Model Level->Group Model Level. Stopping at the first positive or negative. 59 56 60 The has_perm method has been modified to now check for row level permissions and has an optional parameter for a model instance, which is required to check rowlevel permissions.57 The {{{has_perm()}}} method has been modified to now check for row-level permissions and has an optional parameter for a model instance, which is required to check row-level permissions. 61 58 62 59 {{{ … … 89 86 }}} 90 87 91 == Integration into Administration Application ==88 == Integration into administration application == 92 89 93 90 Being worked on. Will post when it is complete or near enough to have a better idea. 94 91 95 == Test Cases of Row Level Permissions ==92 == Test cases of row-level permissions == 96 93 97 94 === API ===