Skip to main content

Personas

Personas are a way of curating assets for a group of users.

List personas

To retrieve a listing of personas, run a search and page the results:

List personas
Persona.select(client) // (1)
.stream() // (2)
.filter(a -> a instanceof Persona) // (3)
.forEach(p -> { // (4)
log.info("Persona: {}", p);
});
  1. To start building up a query specifically for personas, you can use the select() convenience method on Persona itself. Because this operation may need to retrieve information from Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  2. The search will only run when you call the stream() method, which will then lazily-load each page of results into a stream.
  3. (Optional) You can do any other operations you might do on a stream, such as filtering the results to make sure they're of a certain type.
  4. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.

Create persona

To create a new persona:

Create a persona
Persona toCreate = Persona.creator("Data Assets").build(); // (1)
AssetMutationResponse response = toCreate.save(client); // (2)
Persona persona = (Persona) response.getCreatedAssets().get(0); // (3)
  1. Like other builder patterns in the SDK, the creator() method ensures all required information is provided for the persona.
  2. To create the persona in Atlan, call the save() method against the object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  3. You can then retrieve the resulting details of the created persona from the response (you may of course want to do some type checking first).

Retrieve persona

To retrieve a persona by its name:

Retrieve a persona
List<Persona> list = Persona.findByName(client, "Data Assets"); // (1)
  1. The findByName() method handles searching for the persona based on its name, which could therefore return more than one result. You can also (optionally) provide a second parameter with a list of attributes to retrieve for each persona. Because this operation will retrieve information from Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Update persona

To update a persona:

Update a persona
Persona toUpdate = Persona.updater( // (1)
"default/M5HnBQ8QWhrAVGuvBx8iSW", // (2)
"Data Assets", // (3)
true) // (4)
.description("Now with a description!") // (5)
.build();
AssetMutationResponse response = toUpdate.save(client); // (6)
  1. Use the updater() method to update a persona.
  2. You must provide the qualifiedName of the persona.
  3. You must provide the name of the persona.
  4. You must provide whether the persona should be active (enabled) or deactivated after the update.
  5. You can then chain on any other updates, such as changing the description of the persona.
  6. To update the persona in Atlan, call the save() method against the object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Delete persona

To permanently delete a persona:

Delete a persona
Persona.purge(client, "67e08ab7-9688-40bc-ae4a-da2bc06b1588"); // (1)
  1. To permanently delete a persona in Atlan, call the purge() method with the GUID of the persona. Because this operation will remove the structure from Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Activate or deactivate persona

Alternatively, if you only want to temporarily deactivate a persona:

Deactivate a persona
Persona toUpdate = Persona.updater( // (1)
"default/M5HnBQ8QWhrAVGuvBx8iSW", // (2)
"Data Assets", // (3)
false) // (4)
.build();
AssetMutationResponse response = toUpdate.save(client); // (5)
  1. Use the updater() method to update the persona.
  2. You must provide the qualifiedName of the persona.
  3. You must provide the name of the persona.
  4. You must provide whether the persona should be active (enabled) or deactivated after the update. Setting this to false will deactivate the persona, while setting it to true will activate the persona.
  5. To then apply that activation / deactivation to the persona in Atlan, call the save() method against the object you've built. Because this operation will persist the state in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Add subjects to persona

Similarly, adding subjects to a persona is a matter of updating the persona:

Add subjects to a persona
Persona toUpdate = Persona.updater( // (1)
"default/M5HnBQ8QWhrAVGuvBx8iSW", // (2)
"Data Assets", // (3)
false) // (4)
.personaGroup("group1") // (5)
.personaGroup("group2")
.personaUser("jsmith") // (6)
.personaUser("jdoe")
.build();
AssetMutationResponse response = toUpdate.save(client); // (7)
  1. Use the updater() method to update the persona.
  2. You must provide the qualifiedName of the persona.
  3. You must provide the name of the persona.
  4. You must provide whether the persona should be active (enabled) or deactivated after the update.
  5. You can then chain any number of updates to the personaGroup() property. These should be internal names of groups that you want to be controlled through the persona's policies.
  6. Similarly, you can chain any number of updates to the personaUser() property. These should be usernames of users that you want to be controlled through the persona's policies.
  7. To then apply those membership updates to the persona in Atlan, call the save() method against the object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Add policies to persona

Don't add policies in bulk

Be careful to only add policies one-by-one to a persona. While the SDKs will allow you to add them in bulk, currently this results in a persona where only the final policy in the batch is active at the end of the operation.

API token must be a connection admin

To manage policies for a connection, the API token must be a connection admin on that connection. When you create a connection using an API token, the API token is automatically made a connection admin; however, for any other connection you must carry out extra steps to make the API token a connection admin.

Add metadata policy

To add a metadata policy to a persona:

Add metadata policy to persona
AuthPolicy metadata = Persona.createMetadataPolicy( // (1)
"Simple read access", // (2)
"67e08ab7-9688-40bc-ae4a-da2bc06b1588", // (3)
AuthPolicyType.ALLOW, // (4)
Set.of(PersonaMetadataAction.READ), // (5)
"default/snowflake/1234567890", // (6)
Set.of("entity:default/snowflake/1234567890")) // (7)
.build();
AssetMutationResponse response = metadata.save(client); // (8)
  1. Use the createMetadataPolicy() method to start building a metadata policy with the minimal required information.

  2. You must give the policy a name.

  3. You must provide the GUID of the persona to attach this policy to.

  4. Specify the type of policy (granting or denying the actions specified next).

  5. Specify the set of permissions you want to allow (or deny) in this policy.

    To include all permissions

If you want to include all permissions, you can simply use Arrays.asList(PersonaMetadataAction.values()). ::: 6. Specify the qualifiedName of the connection whose assets this policy should control. 7. Specify the set of qualifiedName prefixes for the assets this policy should control. Each qualifiedName should itself be prefixed with entity:. To control all assets within a connection, this can simply be the qualifiedName of the connection itself. 8. To then add the policy to the persona in Atlan, call the save() method against the policy object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Add data policy

To add a data policy to a persona:

Add data policy to persona
AuthPolicy data = Persona.createDataPolicy( // (1)
"Allow access to data", // (2)
"67e08ab7-9688-40bc-ae4a-da2bc06b1588", // (3)
AuthPolicyType.ALLOW, // (4)
"default/snowflake/1234567890", // (5)
Set.of("entity:default/snowflake/1234567890")) // (6)
.build();
AssetMutationResponse response = data.save(client); // (7)
  1. Use the createDataPolicy() method to start building a data policy with the minimal required information.
  2. You must give the policy a name.
  3. You must provide the GUID of the persona to attach this policy to.
  4. Specify the type of policy (granting or denying access to the data of the resources specified next).
  5. Specify the qualifiedName of the connection whose assets this policy should control.
  6. Specify the set of qualifiedName prefixes for the assets this policy should control. Each qualifiedName should itself be prefixed with entity:. To control all assets within a connection, this can simply be the qualifiedName of the connection itself.
  7. To then add the policy to the persona in Atlan, call the save() method against the policy object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Add glossary policy

To add a glossary policy to a persona:

Add glossary policy to persona
AuthPolicy glossary = Persona.createGlossaryPolicy( // (1)
"All glossaries", // (2)
"67e08ab7-9688-40bc-ae4a-da2bc06b1588", // (3)
AuthPolicyType.ALLOW, // (4)
Set.of(PersonaGlossaryAction.CREATE, PersonaGlossaryAction.UPDATE), // (5)
Set.of("entity:OpU9a9kG825gAqpamXugf")) // (6)
.build();
AssetMutationResponse response = glossary.save(client); // (7)
  1. Use the createGlossaryPolicy() method to start building a glossary policy with the minimal required information.

  2. You must give the policy a name.

  3. You must provide the GUID of the persona to attach this policy to.

  4. Specify the type of policy (granting or denying the actions specified next).

  5. Specify the set of permissions you want to allow (or deny) in this policy.

    To include all permissions

If you want to include all permissions, you can simply use Arrays.asList(PersonaGlossaryAction.values()). ::: 6. Specify the set of qualifiedNames of glossaries this policy should control. Each qualifiedName should itself be prefixed with entity:. 7. To then add the policy to the persona in Atlan, call the save() method against the policy object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Add domain policy

To add a domain policy to a persona:

Add domain policy to persona
AuthPolicy domain = Persona.createDomainPolicy( // (1)
"Read access to some domains", // (2)
"67e08ab7-9688-40bc-ae4a-da2bc06b1588", // (3)
Set.of(PersonaDomainAction.READ_DOMAIN, PersonaDomainAction.READ_SUBDOMAIN, PersonaDomainAction.READ_PRODUCTS), // (4)
Set.of("entity:default/domain/marketing", "entity:default/domain/finance")) // (5)
.build();
AssetMutationResponse response = domain.save(client); // (6)
  1. Use the createDomainPolicy() method to start building a domain policy with the minimal required information.

  2. You must give the policy a name.

  3. You must provide the GUID of the persona to attach this policy to.

  4. Specify the set of permissions you want to allow in this policy.

    To include all permissions

If you want to include all permissions, you can simply use Arrays.asList(PersonaDomainAction.values()). ::: 5. Specify the set of qualifiedNames for the domains this policy should control. Each qualifiedName should itself be prefixed with entity:. To control all domains, this can simply be a single value of entity:All domains. 6. To then add the policy to the persona in Atlan, call the save() method against the policy object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

List policies in persona

To list all the policies in a persona:

List all policies in a persona
Persona.select(client) // (1)
.where(Persona.NAME.eq("Data Assets")) // (2)
.includeOnResults(Persona.POLICIES) // (3)
.includeOnRelations(AuthPolicy.NAME) // (4)
.includeOnRelations(AuthPolicy.POLICY_TYPE)
.includeOnRelations(AuthPolicy.POLICY_RESOURCES)
.includeOnRelations(AuthPolicy.POLICY_ACTIONS)
.stream() // (5)
.filter(a -> a instanceof Persona)
.forEach(p -> { // (6)
Set<IAuthPolicy> policies = ((Persona) p).getPolicies();
for (IAuthPolicy policy : policies)
});
  1. Start by selecting a persona, here using a FluentSearch-based approach. Because this operation will retrieve information from Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  2. You can select the persona by whatever you like, in this example we're selecting based on its name.
  3. Include the policies for the persona as part of the search results.
  4. Include all the attributes you want about each policy on the relations of the search results. Here we're including the name, type, actions and resources controlled by each policy.
  5. You can then directly stream the results of the search.
  6. For each result of the search (itself a Persona), you can then retrieve its policies and iterate through them.

Personalize persona

To personalize which details to show for assets within a persona:

Personalize the persona
Persona toUpdate = Persona.updater( // (1)
"default/M5HnBQ8QWhrAVGuvBx8iSW", // (2)
"Data Assets", // (3)
true) // (4)
.denyAssetTab(AssetSidebarTab.LINEAGE) // (5)
.denyAssetTab(AssetSidebarTab.RELATIONS)
.denyAssetTab(AssetSidebarTab.QUERIES)
.denyAssetType("Table") // (6)
.denyAssetType("Column")
.denyAssetFilter(AssetFilterGroup.TAGS) // (7)
.denyAssetFilter(AssetFilterGroup.OWNERS)
.denyAssetFilter(AssetFilterGroup.CERTIFICATE)
.denyCustomMetadataGuid("59220d25-5d39-4f3a-8de5-072098bee793") // (8)
.denyCustomMetadataGuid("bb0c9836-94fd-4a54-9007-0f25fb802c2c")
.build();
AssetMutationResponse response = toUpdate.save(client); // (9)
  1. Use the updater() method to update a persona.
  2. You must provide the qualifiedName of the persona.
  3. You must provide the name of the persona.
  4. You must provide whether the persona should be active (enabled) or deactivated after the update.
  5. You can then chain preferences on which metadata tabs should be hidden when using this persona.
  6. You can then set preferences on which asset types should be hidden when using this persona.
  7. You can then set preferences on which asset filters should be hidden when using this persona.
  8. You can then set preferences on which custom metadata should be hidden when using this persona.
  9. To update the persona in Atlan, call the save() method against the object you've built. Because this operation will persist the structure in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
Was this page helpful?