Package org.jasig.portal.security

Examples of org.jasig.portal.security.IAuthorizationPrincipal


    */
   protected void deletePermissions (IGroupMember grpMbr) throws Exception{
      try {
         String grpKey = grpMbr.getKey();
         // first we retrieve all permissions for which the group is the principal
         IAuthorizationPrincipal iap = AuthorizationService.instance().newPrincipal(grpMbr);
         IPermission[] perms1 = iap.getPermissions();

         // next we retrieve all permissions for which the group is the target
         IUpdatingPermissionManager upm = AuthorizationService.instance().newUpdatingPermissionManager(OWNER);
         IPermission[] perms2 = upm.getPermissions(null, grpKey);

View Full Code Here


        this.ssTitle = "friendly";
        try {
            final AuthorizationService authService = AuthorizationService.instance();
            final IPerson person = userPreferencesManager.getPerson();
            final EntityIdentifier ei = person.getEntityIdentifier();
            final IAuthorizationPrincipal ap = authService.newPrincipal(ei.getKey(), ei.getType());
           
            if (ap.hasPermission(SupportedPermissions.OWNER, SupportedPermissions.VIEW_ACTIVITY, SupportedPermissions.DETAILS_TARGET)) {
                this.ssTitle = "detailed";
            }
        }
        catch (Throwable t) {
            log.error("Exception checking whether user authorized to view detailed CError view.  Defaulting to friendly view.", t);
View Full Code Here

        Element heading = doc.createElement("heading");
        root.appendChild(heading);
        heading.appendChild(doc.createTextNode(resolveLabel(resolver,
                HEADER_PROPERTY, locale)));
       
        IAuthorizationPrincipal ap = staticData.getAuthorizationPrincipal();

        for(Iterator iter = cLinks.iterator(); iter.hasNext(); )
        {
            // determine if user has permission for rendering
            Link link = (Link)iter.next();
           
            try
            {
                if ( ap.canSubscribe(link.publishIdOfTargetChannel) )
                {
                    if (LOG.isDebugEnabled())
                        LOG.debug("User can render channel '"
                                + link.publishIdOfTargetChannel
                                + "' with url '" + link.url + "'");
View Full Code Here

         }
         rootElem.setAttribute("hasMembers", String.valueOf(hasMems));

         // set user permissions for group
         IGroupsManagerPermissions gmp = sessionData.gmPermissions;
         IAuthorizationPrincipal ap = sessionData.authPrincipal;
         applyPermissions (rootElem, gm, gmp, ap);

         // If no rdf element, create it, otherwise refresh the element
         NodeList nList = rootElem.getElementsByTagName("rdf:RDF");
         if (nList.getLength() == 0) {
View Full Code Here

    */
   protected void deletePermissions (IGroupMember grpMbr) throws Exception{
      try {
         String grpKey = grpMbr.getKey();
         // first we retrieve all permissions for which the group is the principal
         IAuthorizationPrincipal iap = AuthorizationService.instance().newPrincipal(grpMbr);
         IPermission[] perms1 = iap.getPermissions();

         // next we retrieve all permissions for which the group is the target
         IUpdatingPermissionManager upm = AuthorizationService.instance().newUpdatingPermissionManager(OWNER);
         IPermission[] perms2 = upm.getPermissions(null, grpKey);

View Full Code Here

       */
      ChannelStaticData staticData = sessionData.staticData;
      Document model = sessionData.model;
      ArrayList perms = new ArrayList();
      IUpdatingPermissionManager upm = AuthorizationService.instance().newUpdatingPermissionManager(OWNER);
      IAuthorizationPrincipal ap = staticData.getAuthorizationPrincipal();
      Utility.logMessage("DEBUG", "GroupManagerXML::createPermissions(): The IAuthorizationPrincipal: " + ap);
      String[] activities = ((IPermissible)Class.forName(OWNER).newInstance()).getActivityTokens();
      IPermission prm;
      for (int a = 0; a < activities.length; a++) {
         prm = upm.newPermission(ap);
View Full Code Here

    * @param apRoot
    * @param xmlDoc
    * @return Element
    */
   public static Element getAuthorizationXml (ChannelStaticData sd, Element apRoot, Document xmlDoc) {
      IAuthorizationPrincipal ap = sd.getAuthorizationPrincipal();
      String princTagname = "principal";
      if (ap != null && apRoot == null) {
         apRoot = xmlDoc.createElement(princTagname);
         apRoot.setAttribute("token", ap.getPrincipalString());
         apRoot.setAttribute("type", ap.getType().getName());
         String name = ap.getKey();
         try {
            name = EntityNameFinderService.instance().getNameFinder(ap.getType()).getName(name);
         } catch (Exception e) {
            Utility.logMessage("ERROR", e.toString(), e);
         }
         apRoot.setAttribute("name", name);
      }
      if (ap == null) {
      Utility
          .logMessage(
              "WARN",
              "GroupsManagerXML::getAuthorizationXml: Authorizationprincipal was null; proceeding with empty permissions");
    } else {
      try {
        // owner, activity, target
        IPermission[] perms = ap.getAllPermissions(OWNER, null, null);
        for (int yy = 0; yy < perms.length; yy++) {
          Element prm = getPermissionXml(xmlDoc, perms[yy]
              .getPrincipal(), perms[yy].getActivity(), perms[yy]
              .getType(), perms[yy].getTarget());
          apRoot.appendChild(prm);
View Full Code Here

         rootElem.setAttribute("displayName", GroupsManagerXML.getEntityName(ent.getLeafType(),
               ent.getKey()));
         rootElem.setAttribute("selected", "false");
         // set user permissions for entity
         IGroupsManagerPermissions gmp = sessionData.gmPermissions;
         IAuthorizationPrincipal ap = sessionData.authPrincipal;
         applyPermissions (rootElem, gm, gmp, ap);
      } catch (Exception e) {
         Utility.logMessage("ERROR", "EntityWrapper.getXml(): ERROR retrieving entity "
               + e, e);
      }
View Full Code Here

     * @see org.jasig.portal.IChannelRegistryStore#getChannelDefinitions(org.jasig.portal.security.IPerson)
     */
    public List<IChannelDefinition> getChannelDefinitions(IPerson person) {
     
        EntityIdentifier ei = person.getEntityIdentifier();
        IAuthorizationPrincipal ap = AuthorizationService.instance().newPrincipal(ei.getKey(), ei.getType());
     
        List<IChannelDefinition> defs = channelDao.getChannelDefinitions();
        List<IChannelDefinition> manageableChannels = new ArrayList<IChannelDefinition>();
       
      for(IChannelDefinition def : defs) {
        if(ap.canSubscribe(def.getId())) {
          manageableChannels.add(def);
        }
      }
     
      return manageableChannels;
View Full Code Here

      AuthorizationService authService = AuthorizationService.instance();
      String target = IPermission.CHANNEL_PREFIX + definition.getId();
      IUpdatingPermissionManager upm = authService.newUpdatingPermissionManager(FRAMEWORK_OWNER);
      IPermission[] permissions = new IPermission[groupMembers.length];
      for (int i = 0; i < groupMembers.length; i++) {
        IAuthorizationPrincipal authPrincipal = authService.newPrincipal(groupMembers[i]);
        permissions[i] = upm.newPermission(authPrincipal);
        permissions[i].setType(GRANT_PERMISSION_TYPE);
        permissions[i].setActivity(SUBSCRIBER_ACTIVITY);
        permissions[i].setTarget(target);
      }
View Full Code Here

TOP

Related Classes of org.jasig.portal.security.IAuthorizationPrincipal

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.