public interface ResourceService
Resource. A Resource can be anything that is meant to be protected by the consumer modules. For
instance, a Resource could be an Alert, an Inventory item or a Metric. Can be injected via CDI into managed beans
as follows:
@Inject ResourceService resourceService;
Concrete implementations do not hold any state, but it's advised to get an instance through CDI or as an EJB.| Modifier and Type | Method and Description |
|---|---|
PersonaResourceRole |
addRoleToPersona(Resource resource,
Persona persona,
Role role)
Adds a Role to a Persona into a Resource
|
Resource |
create(String id,
Persona persona)
|
Resource |
create(String id,
Resource parent)
Creates a new sub resource, based on a given ID and owning resource
|
Resource |
create(String id,
Resource parent,
Persona persona)
Creates a new sub resource, based on a given ID, parent and owned by the specified
Persona |
void |
delete(String id)
Removes a
Resource based on its ID. |
Resource |
get(String id)
Deprecated.
Use
getById(UUID) |
Resource |
getById(UUID id)
Retrieves a
Resource based on its ID. |
List<Resource> |
getByPersona(Persona persona)
Lists all the resources that belong to a given persona.
|
List<PersonaResourceRole> |
getRolesForPersona(Resource resource,
Persona persona)
Deprecated.
|
void |
revokeAllForPersona(Resource resource,
Persona persona)
Revoke all roles that the given persona has on the resource.
|
void |
transfer(Resource resource,
Persona persona)
Transfers the resource to the given persona.
|
@Deprecated Resource get(String id)
getById(UUID)Resource based on its ID. If the ID is not "UUID-like", then a new UUID is created based
on the bytes of the given ID. By "UUID-like", we mean a string that matches a regular expression for the
appearance of an UUID such as 'eb66fa08-7cbf-11e5-8cdd-3c970e9648d7'.id - the resource's IDResource or null if the resource doesn't exists.IllegalArgumentException - if the given ID is nullUUID.nameUUIDFromBytes(byte[])Resource getById(UUID id)
Resource based on its ID.id - the resource's IDResource or null if the resource doesn't exists.IllegalArgumentException - if the given ID is nullResource create(String id, Persona persona)
id - the ID to be assigned to this resource or null for a new UUIDpersona - a valid owner for this resourceResourceIllegalArgumentException - if the persona is nullResource create(String id, Resource parent)
id - the ID to be assigned to this resource or null for a new UUIDparent - a valid resource to serve as the parent of this sub resourceResourceIllegalArgumentException - if the parent is nullResource create(String id, Resource parent, Persona persona)
Personaid - the ID to be assigned to this resource or null for a new UUIDparent - the resource's parent or null if the owner is providedpersona - the resource's owner or null if the parent is providedResourceIllegalArgumentException - if both the parent and the owner are nullvoid delete(String id)
Resource based on its ID.id - the resource's IDIllegalArgumentException - if the given ID is nullList<Resource> getByPersona(Persona persona)
persona - the persona that owns the resourcesvoid transfer(Resource resource, Persona persona)
revokeAllForPersona(Resource, Persona) if it's
appropriate. This method also revokes all the current permissions of the new owner, replacing all of them by a
single "SuperUser" role on the resource.resource - the resource to receive the new ownerpersona - the persona that will be the new ownervoid revokeAllForPersona(Resource resource, Persona persona)
resource - the resource that the person currently has rolespersona - the persona to get the access revokedPersonaResourceRole addRoleToPersona(Resource resource, Persona persona, Role role)
resource - the resourcepersona - the persona to get access to the resourcerole - the role of the persona on the resource@Deprecated List<PersonaResourceRole> getRolesForPersona(Resource resource, Persona persona)
PersonaResourceRoleService.getByPersonaAndResource(Persona, Resource) insteadresource - the resource to checkpersona - the persona to checkPersonaResourceRole, with one entry per combination.Copyright © 2015–2016 Red Hat, Inc.. All rights reserved.