You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -737,9 +737,9 @@ client
737
737
###Attributes service
738
738
Attributes, also called profile attributes, are name-value pairs associated with a user, organization or server. Certain advanced features such as Domain security and OLAP access grants use profile attributes in addition to roles to grant certain permissions. Unlike roles, attributes are not pre-defined, and thus any attribute name can be assigned any value at any time.
739
739
Attributes service provides methods for reading, writing, and deleting attributes on any given holder (server, organization or user account). All attribute operations apply to a single specific holder; there are no operations for reading or searching attributes from multiple holders.
740
-
Because the holder id is used in the URL, this service can operate only on holders whose ID is less than 100 characters long and does not contain spaces or special symbols. In addition, both attribute names and attribute values being written with this service are limited to 255 characters and may not be empty (null) or not contain only whitespace characters.
740
+
As the holder's id is used in the URL, this service can operate only on holders whose ID is less than 100 characters long and does not contain spaces or special symbols. In addition, both attribute names and attribute values being written with this service are limited to 255 characters and may not be empty (null) or not contain only whitespace characters.
741
741
####Viewing User Attributes
742
-
The code below retrieves single attribute defined for the user:
742
+
The code below allow you to retrieve single attribute defined for the user:
743
743
```java
744
744
HypermediaAttribute userAttribute = session
745
745
.attributesService()
@@ -786,22 +786,21 @@ The code below retrieves the list of attributes defined for the user.
Be careful with definition of attribute names because the server uses different strategies for creating or updating attributes depending on list of attribute names, list of attributes and existing attributes on the server:
833
-
1. if requested attribute name in `attributes()` method matches with attribute name of object defined in `createOrUpdate()` method and the attribute does not exist on the server it will be *created* on the server;
834
-
2. if requested attribute name in `attributes()` method matches with attribute name of object defined in `createOrUpdate()` method and the attribute exists on the server it will be *updated* on the server;
835
-
3. if requested attribute name in `attributes()` method does not match with any attribute names of object defined in `createOrUpdate()` method and the attribute exists on the server it will be *deleted* on the server;
832
+
1. if requested attributes' names in `attributes()` method matches with attribute name of object defined in `createOrUpdate()` method and the attribute does not exist on the server it will be *created* on the server;
833
+
2. if requested attributes' names in `attributes()` method matches with attribute name of object defined in `createOrUpdate()` method and the attribute exists on the server it will be *updated* on the server;
834
+
3. if requested attributes' names in `attributes()` method does not match with any attribute names of object defined in `createOrUpdate()` method and the attribute exists on the server it will be *deleted* on the server;
836
835
4. if requested attribute in `createOrUpdate()` method method does not match with any attribute names in `attributes()` it will be *ignored* and will not be sent to the server;
837
-
836
+
5. if requested list of attributes' names in `attributes()` method is empty or you use `allAttributes()` method and pass attributes in `createOrUpdate()` method - the existing attributes on the server it will be complitely *replaced* with passed ones:
837
+
```java
838
+
session
839
+
.attributesService()
840
+
.forOrganization("organization_1")
841
+
.forUser("jasperadmin")
842
+
.allAttributes()
843
+
.createOrUpdate(serverAttributes);
844
+
```
838
845
The second way of using the attributes service is adding or replacing individual attribute:
0 commit comments