Package org.dspace.eperson

Examples of org.dspace.eperson.Group


    private static boolean doState(Context c, WorkflowItem wi, int newstate,
            EPerson newowner) throws SQLException, IOException,
            AuthorizeException
    {
        Collection mycollection = wi.getCollection();
        Group mygroup = null;
        boolean archived = false;

        wi.setState(newstate);

        switch (newstate)
        {
        case WFSTATE_STEP1POOL:

            // any reviewers?
            // if so, add them to the tasklist
            wi.setOwner(null);

            // get reviewers (group 1 )
            mygroup = mycollection.getWorkflowGroup(1);

            if ((mygroup != null) && !(mygroup.isEmpty()))
            {
                // get a list of all epeople in group (or any subgroups)
                EPerson[] epa = Group.allMembers(c, mygroup);
               
                // there were reviewers, change the state
                //  and add them to the list
                createTasks(c, wi, epa);
                wi.update();

                // email notification
                notifyGroupOfTask(c, wi, mygroup, epa);
            }
            else
            {
                // no reviewers, skip ahead
                archived = doState(c, wi, WFSTATE_STEP2POOL, null);
            }

            break;

        case WFSTATE_STEP1:

            // remove reviewers from tasklist
            // assign owner
            deleteTasks(c, wi);
            wi.setOwner(newowner);

            break;

        case WFSTATE_STEP2POOL:

            // clear owner
            // any approvers?
            // if so, add them to tasklist
            // if not, skip to next state
            wi.setOwner(null);

            // get approvers (group 2)
            mygroup = mycollection.getWorkflowGroup(2);

            if ((mygroup != null) && !(mygroup.isEmpty()))
            {
                //get a list of all epeople in group (or any subgroups)
                EPerson[] epa = Group.allMembers(c, mygroup);
               
                // there were approvers, change the state
                //  timestamp, and add them to the list
                createTasks(c, wi, epa);

                // email notification
                notifyGroupOfTask(c, wi, mygroup, epa);
            }
            else
            {
                // no reviewers, skip ahead
                archived = doState(c, wi, WFSTATE_STEP3POOL, null);
            }

            break;

        case WFSTATE_STEP2:

            // remove admins from tasklist
            // assign owner
            deleteTasks(c, wi);
            wi.setOwner(newowner);

            break;

        case WFSTATE_STEP3POOL:

            // any editors?
            // if so, add them to tasklist
            wi.setOwner(null);
            mygroup = mycollection.getWorkflowGroup(3);

            if ((mygroup != null) && !(mygroup.isEmpty()))
            {
                // get a list of all epeople in group (or any subgroups)
                EPerson[] epa = Group.allMembers(c, mygroup);
               
                // there were editors, change the state
View Full Code Here


                    {
                      // Normal users can not maintain their sessions, check to see if this is really an
                      // administrator loging in as someone else.
                     
                      EPerson realEPerson = EPerson.find(context, realid);
                      Group administrators = Group.find(context,1);
                       if (!administrators.isMember(realEPerson))
                       {
                         // Log this user out because sessions are being restricted by a systemwide alert.
                         context.setCurrentUser(null);
                         return;
                       }
View Full Code Here

        throw new AuthorizeException("Only authenticated users whom are administrators may assume the login as another user.");
     
      // You may not assume the login of another super administrator
      if (loginAs == null)
        return;
      Group administrators = Group.find(context,1);
      if (administrators.isMember(loginAs))
        throw new AuthorizeException("You may not assume the login as another super administrator.");
     
      // Success, allow the user to login as another user.
      context.setCurrentUser(loginAs);
 
View Full Code Here

            validityKey.append(eperson.canLogIn());
            validityKey.append(eperson.getRequireCertificate());
        }
        else if (dso instanceof Group)
        {
            Group group = (Group) dso;
           
            validityKey.append("Group:");
           
            validityKey.append(group.getID());
            validityKey.append(group.getName());
        }
        else
        {
            throw new IllegalArgumentException("DSpaceObject of type '"+dso.getClass().getName()+"' is not supported by the DSpaceValidity object.");
        }   
View Full Code Here

    int groupID = parameters.getParameterAsInteger("groupID",-1);
    String currentName = URLDecode(parameters.getParameter("groupName",null));
    if (currentName == null || currentName.length() == 0)
      currentName = FlowGroupUtils.getName(context, groupID);
   
    Group group = null;
    if (groupID >= 0)
      group = Group.find(context,groupID);
     
   
    // Find the collection or community if applicable
    Collection collection = null;
    Community community = null;
    if (group != null)
    {
      int collectionID = FlowGroupUtils.getCollectionId(group.getName());
      if (collectionID > -1)
        collection = Collection.find(context, collectionID);
      else
      {
          int communityID = FlowGroupUtils.getCommunityId(group.getName());
          if (communityID > -1)
              community = Community.find(context, communityID);
        }
    }
   
    // Get list of member groups
    String memberGroupIDsString = parameters.getParameter("memberGroupIDs",null);
    ArrayList<Integer> memberGroupIDs = new ArrayList<Integer>();
    if (memberGroupIDsString != null)
    {
      for (String id : memberGroupIDsString.split(","))
      {
        if (id.length() > 0)
          memberGroupIDs.add(Integer.valueOf(id));
      }
    }
     
    // Get list of member epeople
    String memberEPeopleIDsString = parameters.getParameter("memberEPeopleIDs",null);
    ArrayList<Integer> memberEPeopleIDs = new ArrayList<Integer>();
    if (memberEPeopleIDsString != null)
    {
      for (String id : memberEPeopleIDsString.split(","))
        if (id.length() > 0)
          memberEPeopleIDs.add(Integer.valueOf(id));
    }
   
    // Get highlight parameters
    int highlightEPersonID = parameters.getParameterAsInteger("highlightEPersonID",-1);
    int highlightGroupID = parameters.getParameterAsInteger("highlightGroupID",-1);
   
    // Get search parameters
      String query = URLDecode(parameters.getParameter("query",null));
      int page     = parameters.getParameterAsInteger("page",0);
      String type  = parameters.getParameter("type",null);
     
      // Get any errors
      String errorString = parameters.getParameter("errors",null);
    ArrayList<String> errors = new ArrayList<String>();
    if (errorString != null)
      for (String error : errorString.split(","))
        errors.add(error);
     
   
     
      //DIVISION: group-edit
      Division main = body.addInteractiveDivision("group-edit",contextPath+"/admin/groups",Division.METHOD_POST,"primary administrative groups");
      if (group == null)
        main.setHead(T_main_head_new);
      else
        main.setHead(T_main_head.parameterize(group.getName(),groupID));
  
     
      if(collection != null)
      {
        Para para = main.addPara();
View Full Code Here

   * all the groups involved to essentially include themselves. 
   */
  private boolean isDescendant(Group descendant, Group ancestor, ArrayList<Integer> memberGroupIDs) throws SQLException
  {
    Queue<Group> toVisit = new LinkedList<Group>();
    Group currentGroup;
   
    toVisit.offer(ancestor);
   
    // Initialize by adding a list of our current list of group members.
    for (Integer groupid : memberGroupIDs)
    {
      Group member = Group.find(context,groupid);
      toVisit.offer(member);
    }
   
    while (!toVisit.isEmpty()) {
      // 1. Grab a group from the queue
View Full Code Here

        Collections.sort(allMemberGroupIDs);
       
        // Loop through all group ids and display them.
        for (Integer groupID : allMemberGroupIDs)
        {
          Group group = Group.find(context,groupID);
          boolean highlight = (group.getID() == highlightGroupID);
          boolean pendingAddition = !parent.isMember(group);
          boolean pendingRemoval = !memberGroupIDs.contains(groupID);
          addMemberRow(table, group, highlight,pendingAddition,pendingRemoval);  
         
          if (pendingAddition || pendingRemoval)
View Full Code Here

        Context context = null;
        try {
            context = new Context();
            refreshParams(context);

            Group comm = Group.find(context, Integer.parseInt(id));
            return comm != null ? true : false;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (NumberFormatException ex) {
            throw new EntityException("Bad request", "Could not parse input", 400);
View Full Code Here

        }
    }

    public Object groups(EntityReference ref, UserRequestParams uparams, Context context) {
        try {
            Group res = Group.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, res, Constants.READ);

            for (Group group : res.getMemberGroups()) {
                if (group.getMemberGroups().length > 0) {
                    groups.add(new GroupEntity(group));
                } else {
                    groups.add(new GroupEntityTrim(group));
                }
View Full Code Here

        }
    }

    public Object users(EntityReference ref, UserRequestParams uparams, Context context) {
        try {
            Group res = Group.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, res, Constants.READ);

            for (EPerson member : res.getMembers()) {
                users.add(new UserEntityTrim(member));
            }
            return users;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
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.