Search in sources :

Example 1 with PermissionFactory

use of org.candlepin.auth.permissions.PermissionFactory in project candlepin by candlepin.

the class User method getPermissions.

/**
 * Full list of permissions for this user.
 *
 * Includes those from roles stored in the database, as well as those explicitly added
 * by the user service adapter.
 *
 * @return full list of permissions for this user.
 */
@XmlTransient
public Set<Permission> getPermissions() {
    PermissionFactory permFactory = new PermissionFactory();
    Set<Permission> perms = new HashSet<>();
    for (Role r : getRoles()) {
        perms.addAll(permFactory.createPermissions(this, r.getPermissions()));
    }
    perms.addAll(this.permissions);
    return perms;
}
Also used : PermissionFactory(org.candlepin.auth.permissions.PermissionFactory) Permission(org.candlepin.auth.permissions.Permission) HashSet(java.util.HashSet) XmlTransient(javax.xml.bind.annotation.XmlTransient)

Aggregations

HashSet (java.util.HashSet)1 XmlTransient (javax.xml.bind.annotation.XmlTransient)1 Permission (org.candlepin.auth.permissions.Permission)1 PermissionFactory (org.candlepin.auth.permissions.PermissionFactory)1