Class GetEffectiveRightsRequestControl
- java.lang.Object
-
- com.unboundid.ldap.sdk.Control
-
- com.unboundid.ldap.sdk.unboundidds.controls.GetEffectiveRightsRequestControl
-
- All Implemented Interfaces:
java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class GetEffectiveRightsRequestControl extends Control
This class provides an implementation of the get effective rights request control, which may be included in a search request to indicate that matching entries should include information about the rights a given user may have when interacting with that entry.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
When the get effective rights control is included in a search request, then each entry returned may include information about the rights that the specified user has for that entry in theaclRights
operational attribute. Note that because this is an operational attribute, it must be explicitly included in the set of attributes to return.
If theaclRights
attribute is included in the entry, then it will be present with multiple sets of options. In one case, it will have an option of "entryLevel", which provides information about the rights that the user has for the entry in general (see theEntryRight
enum for a list of the entry-level rights that can be held). In all other cases, it will have one option of "attributeLevel" and another option that is the name of the attribute for which the set of rights is granted (see theAttributeRight
enum for a list of the attribute-level rights that can be held). In either case, the value will be a comma-delimited list of right strings, where each right string is the name of the right followed by a colon and a one to indicate that the right is granted or zero to indicate that it is not granted. TheEffectiveRightsEntry
class provides a simple means of accessing the information encoded in the values of theaclRights
attribute.
This control was designed by Sun Microsystems, and it is not the same as the get effective rights control referenced in the draft-ietf-ldapext-acl-model Internet draft. The value for this control should be encoded as follows:
GET_EFFECTIVE_RIGHTS := SEQUENCE { authzID authzID, attributes SEQUENCE OF AttributeType OPTIONAL }
Example
The following example demonstrates the use of the get effective rights control to determine whether user "uid=admin,dc=example,dc=com" has the ability to change the password for the user with uid "john.doe":SearchRequest searchRequest = new SearchRequest("dc=example,dc=com", SearchScope.SUB, Filter.createEqualityFilter("uid", "john.doe"), "userPassword", "aclRights"); searchRequest.addControl(new GetEffectiveRightsRequestControl( "dn:uid=admin,dc=example,dc=com")); SearchResult searchResult = connection.search(searchRequest); for (SearchResultEntry entry : searchResult.getSearchEntries()) { EffectiveRightsEntry effectiveRightsEntry = new EffectiveRightsEntry(entry); if (effectiveRightsEntry.rightsInformationAvailable()) { if (effectiveRightsEntry.hasAttributeRight(AttributeRight.WRITE, "userPassword")) { // The admin user has permission to change the target user's password. } else { // The admin user does not have permission to change the target user's // password. } } else { // No effective rights information was returned. } }
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
GET_EFFECTIVE_RIGHTS_REQUEST_OID
The OID (1.3.6.1.4.1.42.2.27.9.5.2) for the get effective rights request control.
-
Constructor Summary
Constructors Constructor Description GetEffectiveRightsRequestControl(boolean isCritical, java.lang.String authzID, java.lang.String... attributes)
Creates a new get effective rights request control with the provided information.GetEffectiveRightsRequestControl(Control control)
Creates a new get effective rights request control which is decoded from the provided generic control.GetEffectiveRightsRequestControl(java.lang.String authzID, java.lang.String... attributes)
Creates a new get effective rights request control with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getAttributes()
Retrieves the names of the attributes for which to calculate the effective rights information.java.lang.String
getAuthzID()
Retrieves the authorization ID of the user for whom to calculate the effective rights.java.lang.String
getControlName()
Retrieves the user-friendly name for this control, if available.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer.-
Methods inherited from class com.unboundid.ldap.sdk.Control
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toString, writeTo
-
-
-
-
Field Detail
-
GET_EFFECTIVE_RIGHTS_REQUEST_OID
@NotNull public static final java.lang.String GET_EFFECTIVE_RIGHTS_REQUEST_OID
The OID (1.3.6.1.4.1.42.2.27.9.5.2) for the get effective rights request control.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GetEffectiveRightsRequestControl
public GetEffectiveRightsRequestControl(@NotNull java.lang.String authzID, @NotNull java.lang.String... attributes)
Creates a new get effective rights request control with the provided information. It will not be marked critical.- Parameters:
authzID
- The authorization ID of the user for whom the effective rights should be calculated. It must not benull
.attributes
- The set of attributes for which to calculate the effective rights.
-
GetEffectiveRightsRequestControl
public GetEffectiveRightsRequestControl(boolean isCritical, @NotNull java.lang.String authzID, @NotNull java.lang.String... attributes)
Creates a new get effective rights request control with the provided information. It will not be marked critical.- Parameters:
isCritical
- Indicates whether this control should be marked critical.authzID
- The authorization ID of the user for whom the effective rights should be calculated. It must not benull
.attributes
- The set of attributes for which to calculate the effective rights.
-
GetEffectiveRightsRequestControl
public GetEffectiveRightsRequestControl(@NotNull Control control) throws LDAPException
Creates a new get effective rights request control which is decoded from the provided generic control.- Parameters:
control
- The generic control to be decoded as a get effective rights request control.- Throws:
LDAPException
- If the provided control cannot be decoded as a get effective rights request control.
-
-
Method Detail
-
getAuthzID
@NotNull public java.lang.String getAuthzID()
Retrieves the authorization ID of the user for whom to calculate the effective rights.- Returns:
- The authorization ID of the user for whom to calculate the effective rights.
-
getAttributes
@NotNull public java.lang.String[] getAttributes()
Retrieves the names of the attributes for which to calculate the effective rights information.- Returns:
- The names of the attributes for which to calculate the effective rights information, or an empty array if no attribute names were specified.
-
getControlName
@NotNull public java.lang.String getControlName()
Retrieves the user-friendly name for this control, if available. If no user-friendly name has been defined, then the OID will be returned.- Overrides:
getControlName
in classControl
- Returns:
- The user-friendly name for this control, or the OID if no user-friendly name is available.
-
-