Package org.dspace.eperson

Examples of org.dspace.eperson.Group


                {
                    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


            policy.setResourceType(resourceType);
            policy.setAction(action);
            policy.setRpType(ResourcePolicy.TYPE_CUSTOM);
        }
        Group policyGroup = Group.find(context, idGroup);
        policy.setGroup(policyGroup);
        policy.setEPerson(ePerson);

        if (embargoDate != null)
        {
View Full Code Here

      // Of course we aren't an administrator yet so we need to
      // circumvent authorisation
      context.setIgnoreAuthorization(true);
     
      // Find administrator group
      Group admins = Group.find(context, 1);
     
      if (admins == null)
      {
        throw new IllegalStateException("Error, no admin group (group 1) found");
      }
     
      // Create the administrator e-person
        EPerson eperson = EPerson.findByEmail(context,email);
       
        // check if the email belongs to a registered user,
        // if not create a new user with this email
        if (eperson == null)
        {
            eperson = EPerson.create(context);
            eperson.setEmail(email);
            eperson.setCanLogIn(true);
            eperson.setRequireCertificate(false);
            eperson.setSelfRegistered(false);
        }
     
      eperson.setLastName(last);
      eperson.setFirstName(first);
      eperson.setLanguage(language);
      eperson.setPassword(pw);
      eperson.update();
     
      admins.addMember(eperson);
      admins.update();
     
      context.complete();
     
      System.out.println("Administrator account created");
    }
View Full Code Here

          // Add each group to the list.
          String[] names = groupNames.split(",");
          for (int i = 0; i < names.length; i++) {
            try {
              Group group = Group.findByName(context,names[i].trim());
              if (group != null)
                groups.add(group.getID());
              else
                log.debug("Unable to find group: '"+names[i].trim()+"'");
            } catch (SQLException sqle) {
              log.error("Exception thrown while trying to lookup affiliation role for group name: '"+names[i].trim()+"'",sqle);
            }
View Full Code Here

            throw ie;
        }

        // create the default authorization policy for collections
        // of 'anonymous' READ
        Group anonymousGroup = Group.find(context, 0);

        ResourcePolicy myPolicy = ResourcePolicy.create(context);
        myPolicy.setResource(c);
        myPolicy.setAction(Constants.READ);
        myPolicy.setGroup(anonymousGroup);
View Full Code Here

        if (workflowGroup[step - 1] == null)
        {
            //turn off authorization so that Collection Admins can create Collection Workflow Groups
            ourContext.turnOffAuthorisationSystem();
            Group g = Group.create(ourContext);
            ourContext.restoreAuthSystemState();

            g.setName("COLLECTION_" + getID() + "_WORKFLOW_STEP_" + step);
            g.update();
            setWorkflowGroup(step, g);

            AuthorizeManager.addPolicy(ourContext, this, Constants.ADD, g);
        }
View Full Code Here

        // Delete collection row
        DatabaseManager.delete(ourContext, collectionRow);

        // Remove any workflow groups - must happen after deleting collection
        Group g = null;

        g = getWorkflowGroup(1);

        if (g != null)
        {
            g.delete();
        }

        g = getWorkflowGroup(2);

        if (g != null)
        {
            g.delete();
        }

        g = getWorkflowGroup(3);

        if (g != null)
        {
            g.delete();
        }

        // Remove default administrators group
        g = getAdministrators();

        if (g != null)
        {
            g.delete();
        }

        // Remove default submitters group
        g = getSubmitters();

        if (g != null)
        {
            g.delete();
        }

        removeMetadataFromDatabase();
    }
View Full Code Here

     */
    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

                                         String name, String description, Date startDate, Date endDate) throws SQLException, 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

                        // See if we have a group name
                        String groupName = ipMatcherGroupNames.get(ipm);

                        if (groupName != null)
                        {
                            Group group = Group.findByName(context, groupName);
                            if (group != null)
                            {
                                // Add ID so we won't have to do lookup again
                                ipMatcherGroupIDs.put(ipm, Integer.valueOf(group.getID()));
                                ipMatcherGroupNames.remove(ipm);

                                groupIDs.add(Integer.valueOf(group.getID()));
                            }
                            else
                            {
                                log.warn(LogManager.getHeader(context,
                                        "configuration_error", "unknown_group="
                                                + groupName));
                            }
                        }
                    }
                }
            }
            catch (IPMatcherException ipme)
            {
                log.warn(LogManager.getHeader(context, "configuration_error",
                        "bad_ip=" + addr), ipme);
            }
        }

        // Now remove any negative matches
        for (IPMatcher ipm : ipNegativeMatchers)
        {
            try
            {
                if (ipm.match(addr))
                {
                    // Do we know group ID?
                    Integer g = ipMatcherGroupIDs.get(ipm);
                    if (g != null)
                    {
                        groupIDs.remove(g);
                    }
                    else
                    {
                        // See if we have a group name
                        String groupName = ipMatcherGroupNames.get(ipm);

                        if (groupName != null)
                        {
                            Group group = Group.findByName(context, groupName);
                            if (group != null)
                            {
                                // Add ID so we won't have to do lookup again
                                ipMatcherGroupIDs.put(ipm, Integer.valueOf(group.getID()));
                                ipMatcherGroupNames.remove(ipm);

                                groupIDs.remove(Integer.valueOf(group.getID()));
                            }
                            else
                            {
                                log.warn(LogManager.getHeader(context,
                                        "configuration_error", "unknown_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.