Package org.dspace.eperson

Examples of org.dspace.eperson.Group


     */
    private static void addAnonymousPolicy(Context c, DSpaceObject t,
            int myaction) throws SQLException, AuthorizeException
    {
        // group 0 is the anonymous group!
        Group anonymousGroup = Group.find(c, 0);

        // now create the default policies for submitted items
        ResourcePolicy myPolicy = ResourcePolicy.create(c);
        myPolicy.setResource(t);
        myPolicy.setAction(myaction);
View Full Code Here


            AuthorizeException
    {
        if (containerType == Constants.COLLECTION)
        {
            Collection collection = Collection.find(c, containerID);
            Group group = Group.find(c, groupID);

            ItemIterator i = collection.getItems();
            try
            {
                if (contentType == Constants.ITEM)
View Full Code Here

            int bsEndIndex = line.indexOf("\t");
            String bitstreamName = line.substring(0, bsEndIndex);

            int actionID = -1;
            String groupName = "";
            Group myGroup = null;
            if (permissionsExist)
            {
                String thisPermission = line.substring(pMarkerIndex
                        + permissionsMarker.length(), pEndIndex);
View Full Code Here

                {
                    myPolicy = new ResourcePolicy(c, row);
                }

                // now do we have a group?
                Group myGroup = myPolicy.getGroup();

                if (myGroup != null)
                {
                    groups.add(myGroup);
                }
View Full Code Here

    String idsString = parameters.getParameter("groupIDs", null);
   
    ArrayList<Group> groups = new ArrayList<Group>();
    for (String id : idsString.split(","))
    {
      Group group = Group.find(context,Integer.valueOf(id));
      groups.add(group);
    }
    
      Division deleted = body.addInteractiveDivision("group-confirm-delete",
          contextPath+"/admin/epeople",Division.METHOD_POST,"primary administrative groups");
      deleted.setHead(T_head);
      deleted.addPara(T_para);
     
      Table table = deleted.addTable("groups-list",groups.size() + 1, 3);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell().addContent(T_column1);
        header.addCell().addContent(T_column2);
        header.addCell().addContent(T_column3);
        header.addCell().addContent(T_column4);
       
      for (Group group : groups)
      { 
        Row row = table.addRow();
        row.addCell().addContent(group.getID());
          row.addCell().addContent(group.getName());
          row.addCell().addContent(group.getMembers().length);
          row.addCell().addContent(group.getMemberGroups().length);
      }
     
      Para buttons = deleted.addPara();
      buttons.addButton("submit_confirm").setValue(T_submit_confirm);
      buttons.addButton("submit_cancel").setValue(T_submit_cancel);
View Full Code Here

    /** Find dspaceGroup in DSpace database, if found, include it into groups */
    private void addGroup(Collection groups, Context context, String dspaceGroup)
    {
        try
        {
            Group g = Group.findByName(context, dspaceGroup);
            if (g == null)
            {
                // oops - no group defined
                log.warn(LogManager.getHeader(context, dspaceGroup
                        + " group is not found!! Admin needs to create one!",
                        "requiredGroup=" + dspaceGroup));
                groups.add(new Integer(0));
            }
            else
            {
                groups.add(new Integer(g.getID()));
            }
            log.info("Mapping group: " + dspaceGroup + " to groupID: "
                    + (g == null ? 0 : g.getID()));
        }
        catch (SQLException e)
        {
            log.error("Mapping group:" + dspaceGroup + " failed with error", e);
        }
View Full Code Here

      if (!context.getCurrentUser().getNetid().equals(""))
      {
        String groupName = ConfigurationManager.getProperty("ldap.login.specialgroup");
        if ((groupName != null) && (!groupName.trim().equals("")))
        {
          Group ldapGroup = Group.findByName(context, groupName);
          if (ldapGroup == null)
          {
            // Oops - the group isn't there.
            log.warn(LogManager.getHeader(context,
                "ldap_specialgroup",
                "Group defined in ldap.login.specialgroup does not exist"));
            return new int[0];
          } else
          {
            return new int[] { ldapGroup.getID() };
          }
        }
      }
    }
    catch (Exception npe) {
View Full Code Here

        // Now create the policies for the submitter and workflow
        // users to modify item and contents
        // contents = bitstreams, bundles
        // FIXME: icky hardcoded workflow steps
        Group step1group = coll.getWorkflowGroup(1);
        Group step2group = coll.getWorkflowGroup(2);
        Group step3group = coll.getWorkflowGroup(3);

        EPerson e = c.getCurrentUser();

        // read permission
        AuthorizeManager.addPolicy(c, i, Constants.READ, e);
View Full Code Here

    private void processInitialQuestions(Context context,
            HttpServletRequest request, HttpServletResponse response,
            Collection collection) throws SQLException, ServletException,
            IOException, AuthorizeException
    {
        Group anonymousGroup = Group.find(context, 0);

        // "Public read" checkbox. Only need to do anything
        // if it's not checked (only system admin can uncheck this!).
        if (!UIUtil.getBoolParameter(request, "public_read")
                && AuthorizeManager.isAdmin(context))
        {
            // Remove anonymous default policies for new items
            AuthorizeManager.removePoliciesActionFilter(context, collection,
                    Constants.DEFAULT_ITEM_READ);
            AuthorizeManager.removePoliciesActionFilter(context, collection,
                    Constants.DEFAULT_BITSTREAM_READ);
        }

        // Some people authorised to submit
        if (UIUtil.getBoolParameter(request, "submitters"))
        {
            // Create submitters group
            Group g = collection.createSubmitters();
        }

        // Check for the workflow steps
        for (int i = 1; i <= 3; i++)
        {
            if (UIUtil.getBoolParameter(request, "workflow" + i))
            {
                // should have workflow step i
                Group g = collection.createWorkflowGroup(i);
            }
        }

        // Check for collection administrators
        if (UIUtil.getBoolParameter(request, "admins"))
        {
            // Create administrators group
            Group g = collection.createAdministrators();
        }

        // Default item stuff?
        if (UIUtil.getBoolParameter(request, "default.item"))
        {
View Full Code Here

        int permission = UIUtil.getIntParameter(request, "permission");

        // First, we deal with the special case of the MIT group...
        if (UIUtil.getBoolParameter(request, "mitgroup"))
        {
            Group mitGroup = Group.findByName(context, "MIT Users");
            int action;

            if (permission == PERM_READ)
            {
                // assign default item and bitstream read to mitGroup
                AuthorizeManager.addPolicy(context, collection,
                        Constants.DEFAULT_ITEM_READ, mitGroup);
                AuthorizeManager.addPolicy(context, collection,
                        Constants.DEFAULT_BITSTREAM_READ, mitGroup);
            }
            else
            {
                // Must be submit
                AuthorizeManager.addPolicy(context, collection, Constants.ADD,
                        mitGroup);
            }
        }

        //We need to add the selected people to the group.
        // First, get the relevant group
        Group g = null;

        switch (permission)
        {
        case PERM_READ:

            // Actually need to create a group for this.
            g = Group.create(context);

            // Name it according to our conventions
            g
                    .setName("COLLECTION_" + collection.getID()
                            + "_DEFAULT_ITEM_READ");

            // Give it the needed permission
            AuthorizeManager.addPolicy(context, collection,
                    Constants.DEFAULT_ITEM_READ, g);
            AuthorizeManager.addPolicy(context, collection,
                    Constants.DEFAULT_BITSTREAM_READ, g);

            break;

        case PERM_SUBMIT:
            g = collection.getSubmitters();

            break;

        case PERM_WF1:
            g = collection.getWorkflowGroup(1);

            break;

        case PERM_WF2:
            g = collection.getWorkflowGroup(2);

            break;

        case PERM_WF3:
            g = collection.getWorkflowGroup(3);

            break;

        case PERM_ADMIN:
            g = collection.getAdministrators();

            break;
        }

        // Add people and groups from the form to the group
        int[] eperson_ids = UIUtil.getIntParameters(request, "eperson_id");
        int[] group_ids = UIUtil.getIntParameters(request, "group_ids");
       
        if (eperson_ids != null)
        {
            for (int i = 0; i < eperson_ids.length; i++)
            {
                EPerson eperson = EPerson.find(context, eperson_ids[i]);

                if (eperson != null)
                {
                    g.addMember(eperson);
                }
            }
        }
       
        if (group_ids != null)
        {
            for (int i = 0; i < group_ids.length; i++)
            {
                Group group = Group.find(context, group_ids[i]);
           
                if (group != null)
                {
                    g.addMember(group);
                }
View Full Code Here

TOP

Related Classes of org.dspace.eperson.Group

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.