Package org.apache.jetspeed.om.security.ldap

Examples of org.apache.jetspeed.om.security.ldap.LDAPRole


 
    public void grantRole(String username, String roleName, String groupName)
        throws JetspeedSecurityException
    {
        LDAPUser user;
        LDAPRole role;
        try
        {
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
            role = (LDAPRole)JetspeedSecurity.getRole(roleName);
        }
View Full Code Here


            roleurls = JetspeedLDAP.search(JetspeedLDAP.buildURL("ou=roles"),
                       "(&(uid=" + roleName + ")(objectclass=jetspeedrole))", ATTRS, true);

            if (roleurls.size() == 1)
            {
                return new LDAPRole((LDAPURL) ((Vector)roleurls.elementAt(0)).firstElement());
            }
            else if(roleurls.size() > 1)
            {
                throw new RoleException("Multiple roles with same name");
            }
View Full Code Here

     */
    public void grantPermission(String roleName, String permissionName)
        throws JetspeedSecurityException
    {
        BasicAttributes attr = new BasicAttributes();
        LDAPRole role;
        LDAPPermission permission;

        try
        {
            role = (LDAPRole)JetspeedSecurity.getRole(roleName);
            permission = (LDAPPermission)JetspeedSecurity.getPermission(permissionName);

            role.addRolePermissions(permissionName);
            role.update(false);

            if (cachingEnable)
            {
                JetspeedSecurityCache.addPermission(roleName, permission);
            }
View Full Code Here

     */
    public void revokePermission(String roleName, String permissionName)
        throws JetspeedSecurityException
    {
        BasicAttributes attr= new BasicAttributes();
        LDAPRole role;
        Vector userurls;

        try
        {
            userurls = JetspeedLDAP.search(JetspeedLDAP.buildURL("ou=roles"),
                       "(&(uid="+ roleName+")(objectclass=jetspeedrole))", ATTRS, true);

            if (userurls.size() == 0)
            {
              throw new PermissionException("Role '" + roleName + "' does not exist!");
            }
            else
            {
                role = new LDAPRole((LDAPURL) ((Vector)userurls.elementAt(0)).firstElement());
                role.getRolePermissions().remove(permissionName);
                role.update(false);

                if (cachingEnable)
                {
                    JetspeedSecurityCache.removePermission(roleName, permissionName);
                }
View Full Code Here

     */
    public boolean hasPermission(String roleName, String permissionName)
        throws JetspeedSecurityException
    {
        BasicAttributes attr= new BasicAttributes();
        LDAPRole role;
        Vector userurls;

        try
        {
            if (cachingEnable)
            {
                return JetspeedSecurityCache.hasPermission(roleName, permissionName);
            }

            userurls = JetspeedLDAP.search(JetspeedLDAP.buildURL("ou=roles"),
                       "(&(uid="+ roleName+")(objectclass=jetspeedrole))", ATTRS, true);

            if (userurls.size() > 0)
            {
                role = new LDAPRole((LDAPURL) ((Vector)userurls.elementAt(0)).firstElement());
                return role.permissionExists(permissionName);
            }
        }
        catch(Exception e)
        {
            throw new PermissionException("Grant permission '" + permissionName + "' to role '" + roleName + "' failed: ", e);
View Full Code Here

     */
    public void joinGroup(String username, String groupname, String rolename)
        throws JetspeedSecurityException
    {
        LDAPUser user;
        LDAPRole role;

        try
        {
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
            role = (LDAPRole)JetspeedSecurity.getRole(rolename);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.security.ldap.LDAPRole

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.