hObjectAttributeRestrictionLabelsForUser
This hook allows plugins to lift restrictions on individual objects on a per-object per-user basis.
For efficiency, this does not affect searches. Adding a per-object rule does not allow a user to search by attributes that are restricted.
P.hook("hObjectAttributeRestrictionLabelsForUser", function(response, user, object, container) {
if(isAuthorOf(user, object)) {
response.userLabelsForObject.add(Label.LiftAllEmbargoRestrictions);
}
});
Arguments
| Name | Type | Description |
user |
SecurityPrincipal |
SecurityPrincipal being queried |
object |
StoreObject |
Object being queries |
container |
StoreObject |
Container object, which may be the object itself |
Response
Return information by changing these properties of the response object.
| Name | Type | Description |
userLabelsForObject |
LabelChanges |
Per-object labels enabling the user to view or edit restricted attributes, specified as changes from the empty label list. |
JavaScript template
P.hook('hObjectAttributeRestrictionLabelsForUser', function(response, user, object, container) {
// Respond to hook, for example
// response.userLabelsForObject = ...
});