Package org.apache.jetspeed.om.security

Examples of org.apache.jetspeed.om.security.Role


    {
        RoleManagement service = getService();

        try
        {
            Role role = service.getRole("user");
            System.out.println("*** role nm = " + role.getName());
            System.out.println("*** role id = " + role.getId());
            assertTrue(role.getName().equals("user"));
        }
        catch (Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
View Full Code Here


    {
        RoleManagement service = getService();

        try
        {
            Role role = service.getRole("user");
            service.saveRole(role);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
View Full Code Here

     * @throws Exception
     */
    public void testGrantRole() throws Exception
    {
        RoleManagement service = getService();
        Role role = null;

        try
        {
            service.grantRole("turbine", "admin");
        }
View Full Code Here

     * @throws Exception
     */
    public void testRevokeRole() throws Exception
    {
        RoleManagement service = getService();
        Role role = null;

        try
        {
            service.revokeRole("turbine", "admin");
        }
View Full Code Here

     * @throws Exception
     */
    public void testHasRole() throws Exception
    {
        RoleManagement service = getService();
        Role role = null;

        try
        {
            boolean has = service.hasRole("admin", "admin");
            assertTrue(true == has);
View Full Code Here

     * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege
     */
    public Iterator getPermissions(String rolename)
        throws JetspeedSecurityException
    {
        Role role = null;
        try
        {
            if (cachingEnable)
            {
                Iterator iterator = JetspeedSecurityCache.getPermissions(rolename);
                if (iterator != null)
                {
                    return iterator;
                }
            }
            role = JetspeedSecurity.getRole(rolename);
        }
        catch(JetspeedSecurityException e)
        {
            logger.error( "Failed to Retrieve Role: ", e );
            throw new PermissionException("Failed to Retrieve Role: ", e);
        }
        Criteria criteria = new Criteria();
        criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
        List rels;
        HashMap perms;

        try
        {
View Full Code Here

    public void grantPermission(String roleName, String permissionName)
        throws JetspeedSecurityException
    {
        try
        {
            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            TurbineRolePermissionPeer.doInsert(criteria);
            if (cachingEnable)
            {
                JetspeedSecurityCache.addPermission(roleName,permission);
View Full Code Here

    public void revokePermission(String roleName, String permissionName)
        throws JetspeedSecurityException
    {
        try
        {
            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            TurbineRolePermissionPeer.doDelete(criteria);
            if (cachingEnable)
            {
                JetspeedSecurityCache.removePermission(roleName, permissionName);
View Full Code Here

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

            Role role = JetspeedSecurity.getRole(roleName);
            Permission permission = this.getPermission(permissionName);

            Criteria criteria = new Criteria();
            criteria.add(TurbineRolePermissionPeer.ROLE_ID, role.getId());
            criteria.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
            permissions = TurbineRolePermissionPeer.doSelect(criteria);

        }
        catch(Exception e)
View Full Code Here

                    if (roles != null)
                    {
                        while (roles.hasNext())
                        {
                            // note: this is an unordered list. will need to change db schema to order it
                            Role role = (Role)roles.next();
                            rundata.getParameters().setString( Profiler.PARAM_ROLE, role.getName() );
                            profile = fallbackProfile(rundata, cm);
                            if (profile != null)
                            {
                                profiles.add(profile);
                            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.security.Role

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.