Examples of IAuthorizationPrincipal


Examples of org.jasig.portal.security.IAuthorizationPrincipal

        while (immediatelyContainingGroups.hasNext()) {
            IGroupMember parentGroup = immediatelyContainingGroups.next();
            try {
                if (parentGroup != null) {
                    IAuthorizationPrincipal parentPrincipal = service.newPrincipal( parentGroup );
                    IPermission[] parentPermissions = service.getPermissionsForPrincipal(parentPrincipal, owner, activity, target);

                    Set<IPermission> activeParentPermissions = activePermissions(parentPermissions);

                    boolean parentPermissionsContainsDeny = containsType(activeParentPermissions, IPermission.PERMISSION_TYPE_DENY);
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

       * registry, assuming the current user has manage permissions.
       */
     
    if (type.equals(TYPE_MANAGE)) {
        EntityIdentifier ei = user.getEntityIdentifier();
          IAuthorizationPrincipal ap = AuthorizationService.instance().newPrincipal(ei.getKey(), ei.getType());

          for (IChannelDefinition channel : allChannels) {
              if (ap.canManage(channel.getId())) {
                  registry.addChannel(new ChannelBean(channel));
              }
          }
      }
   
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

        // build the auth principal for determining if pushed channels can be
        // used by this user
        EntityIdentifier ei = person.getEntityIdentifier();
        AuthorizationService authS = AuthorizationService.instance();
        IAuthorizationPrincipal ap = authS.newPrincipal(ei.getKey(),
                ei.getType());

        // now merge fragments one at a time into ILF document
        Enumeration fragments = sequence.elements();
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

                // DistributedLayoutManager shall gracefully remove channels
                // that the user isn't authorized to render from folders of type
                // 'header' and 'footer'.
                IAuthorizationService authServ = AuthorizationImpl.singleton();
                IAuthorizationPrincipal principal = authServ.newPrincipal(owner.getUserName(), IPerson.class);
                NodeList nodes = userLayoutDocument.getElementsByTagName("folder");
                for (int i=0; i < nodes.getLength(); i++) {
                  Element fd = (Element) nodes.item(i);
                  String type = fd.getAttribute("type");
                  if (type != null && (type.equals("header") || type.equals("footer"))) {
                    // Here's where we do the work...
                    if (LOG.isDebugEnabled()) {
                      LOG.debug("RDBMUserLayoutStore examining the '"
                        + type
                        + "' folder of user '"
                        + owner.getUserName()
                        + "' for non-authorized channels.");
                    }
                    NodeList channels = fd.getElementsByTagName("channel");
                    for (int j=0; j < channels.getLength(); j++) {
                      Element ch = (Element) channels.item(j);
                      try {
                        int chanId = Integer.parseInt(ch.getAttribute("chanID"));
                        if (!principal.canRender(chanId)) {
                          fd.removeChild(ch);
                          if (LOG.isDebugEnabled()) {
                            LOG.debug("RDBMUserLayoutStore removing channel '"
                                  + ch.getAttribute("fname")
                                  + "' from the header or footer of user '"
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

    IPermission[] perms = getPermissionsForPrincipal(principal, owner, activity, target);
    ArrayList<IPermission> al = new ArrayList<IPermission>(Arrays.asList(perms));
    Iterator i = getInheritedPrincipals(principal);
    while ( i.hasNext() )
    {
        IAuthorizationPrincipal p = (IAuthorizationPrincipal) i.next();
        perms = getPermissionsForPrincipal(p, owner, activity, target);
        al.addAll(Arrays.asList(perms));
    }
   
    if (log.isTraceEnabled()) {
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

        { throw new AuthorizationException("Could not retrieve Groups for " + principal,ge) ; }

    while ( i.hasNext() )
    {
        IEntityGroup group = (IEntityGroup) i.next();
        IAuthorizationPrincipal p = getPrincipalForGroup(group);
        al.add(p);
    }
    return al.iterator();
}
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

throws AuthorizationException
{
    Set principals = new HashSet();
    for ( int i=0; i<permissions.length; i++ )
    {
        IAuthorizationPrincipal principal = getPrincipal(permissions[i]);
        principals.add(principal);
    }
    return ((IAuthorizationPrincipal[])principals.toArray(new IAuthorizationPrincipal[principals.size()]));
}
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

* @param type java.lang.Class
*/
public IAuthorizationPrincipal newPrincipal(String key, Class type) {
    final String principalKey = getPrincipalString(type, key);

    IAuthorizationPrincipal principal = null;

    synchronized (this.principalCache) {
        principal = this.principalCache.get(principalKey);
       
        if (principal == null) {
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

    try
    {
        Iterator i = service.getGroupMember(principal).getAllContainingGroups();
        while ( i.hasNext() && ! hasPermission )
        {
            IAuthorizationPrincipal prn = service.newPrincipal( (IGroupMember) i.next() );
            hasPermission = primDoesPrincipalHavePermission(prn, owner, activity, target, service);
         }
    }
    catch ( GroupsException ge )
        { throw new AuthorizationException(ge); }
View Full Code Here

Examples of org.jasig.portal.security.IAuthorizationPrincipal

    IGroupMember everyone = GroupService.getGroupMember(EVERYONE_GROUP_KEY, GROUP_CLASS);
    assertNotNull(msg, everyone);

    msg = "Getting principal for " + everyone;
    print(msg);
    IAuthorizationPrincipal prin = getService().newPrincipal(everyone);
    assertNotNull(msg, prin);

    msg = "Testing DEFAULT permission policy for an existing channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, existingTarget);
    assertTrue(msg, testResult);

    msg = "Testing POSITIVE permission policy for an existing channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, existingTarget, getPositivePermissionPolicy());
    assertTrue(msg, testResult);

    msg = "Testing NEGATIVE permission policy for an existing channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, existingTarget, getNegativePermissionPolicy());
    assertTrue(msg, ! testResult);

    msg = "Testing DEFAULT permission policy for a nonexistent channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, nonExistingTarget);
    assertTrue(msg, ! testResult);

    msg = "Testing POSITIVE permission policy for nonexistent channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, nonExistingTarget, getPositivePermissionPolicy());
    assertTrue(msg, testResult);

    msg = "Testing NEGATIVE permission policy for a nonexistent channel";
    print(msg);
    testResult = prin.hasPermission(OWNER, activity, nonExistingTarget, getNegativePermissionPolicy());
    assertTrue(msg, ! testResult);

    print("***** LEAVING AuthorizationTester.testAlternativePermissionPolicies() *****" + CR);

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.