[Dspace-tech] eperson and groups

846 views
Skip to first unread message

Vegard Korvald

unread,
Aug 26, 2015, 2:32:06 PM8/26/15
to dspac...@lists.sourceforge.net
Hello,

I'm new to DSpace and would be very greatful if one of you could help me with an issue.

Is there a way to add an eperson into groups by using the command line tool or in any other way script it so that we dont have to do it manually? I know there's a solution with LDAP+AD, but unfortunately we can't use this method because we can't authenticate with LDAP.


--
Vegard

helix84

unread,
Aug 26, 2015, 2:32:07 PM8/26/15
to Vegard Korvald, dspac...@lists.sourceforge.net
I don't think it's doable with the currently available CLI commands in DSpace:

You could, however, use a CLI SQL client (psql) to manipulate membership in the epersongroup2eperson table. You can find out the user and group IDs from the eperson and epersongroup table, respectively.

Alternatively, assuming you're using password authentication and want to put all users into a single group, you can use the login.specialgroup option in [dspace]/config/modules/authentication-password.cfg. Please note that special group membership is dynamic - it doesn't appear in the epersongroup2eperson table, but you can check effective membership in the profile of a logged in user.


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Vegard Korvald

unread,
Aug 26, 2015, 2:32:40 PM8/26/15
to hel...@centrum.sk, dspac...@lists.sourceforge.net
Thank you, helix84! By using psql I could add an eperson into a group without any problems.

I used "SELECT * FROM epersongroup " to get the IDs, but I couldn't seem to find the corresponding group name in the database. To find the name I had to look it up as an admin on our DSpace page under Access Control->Groups. Is there a way to find the IDs and names of the groups in the database?


--
Vegard

helix84

unread,
Aug 26, 2015, 2:32:43 PM8/26/15
to Vegard Korvald, dspac...@lists.sourceforge.net
On Thu, May 21, 2015 at 12:22 PM, Vegard Korvald <vegard....@usit.uio.no> wrote:
I used "SELECT * FROM epersongroup " to get the IDs, but I couldn't seem to find the corresponding group name in the database. To find the name I had to look it up as an admin on our DSpace page under Access Control->Groups. Is there a way to find the IDs and names of the groups in the database?

Sorry about that, I forgot to note that since DSpace 5, the epersongroup table changed due to the "metadata for all dspace objects" feature. You can get the same view on the table as in previous versions using this query instead (6 is the constant for group):

SELECT e.*, m.text_value AS name FROM epersongroup e
LEFT JOIN metadatavalue m ON (
  m.resource_id = e.eperson_group_id
  AND m.resource_type_id = 6
)

Daniel Francis

unread,
Aug 26, 2015, 2:32:49 PM8/26/15
to Vegard Korvald, dspac...@lists.sourceforge.net

Dear Vergard,

Perhaps this one will help. in your command line type the following then
(enter)

/dspace/bin/dspace user -a -m sam...@yourdomain.com -g yourname -s surname
User -p yourpassword

sam...@yourdomain.com (email address)

yourname (given name)

surname (your surname)

yourpassword (password)

Regards.

Daniel Francis.

Vegard Korvald

unread,
Aug 26, 2015, 2:32:50 PM8/26/15
to Daniel Francis, dspac...@lists.sourceforge.net
If I'm not mistaken this only creates a user, and does not add it to an existing group.

--
Vegard


>-----Original Message-----
>From: Daniel Francis [mailto:dan...@admin.udsm.ac.tz]
>Sent: Thursday, May 21, 2015 2:39 PM
>To: Vegard Korvald
>Cc: dspac...@lists.sourceforge.net
>Subject: Re: [Dspace-tech] eperson and groups
>
>

Vegard Korvald

unread,
Aug 26, 2015, 2:32:51 PM8/26/15
to hel...@centrum.sk, dspac...@lists.sourceforge.net

That worked like a charm, helix84!

 

Is it possible to make groups with the CLI, similar to the «user» command for creating users, or in any other way script this behavior?

 

 

--

Vegard

 

 

From: ivan....@gmail.com [mailto:ivan....@gmail.com] On Behalf Of helix84
Sent: Thursday, May 21, 2015 12:57 PM
To: Vegard Korvald
Cc: dspac...@lists.sourceforge.net
Subject: Re: [Dspace-tech] eperson and groups

 

On Thu, May 21, 2015 at 12:22 PM, Vegard Korvald <vegard....@usit.uio.no> wrote:

helix84

unread,
Aug 26, 2015, 2:32:52 PM8/26/15
to Vegard Korvald, dspac...@lists.sourceforge.net
On Fri, May 22, 2015 at 9:07 AM, Vegard Korvald <vegard....@usit.uio.no> wrote:

Is it possible to make groups with the CLI, similar to the «user» command for creating users, or in any other way script this behavior?


Well again, not currently using CLI, but using SQL. This used to be just one insert, now it's two. Add a new row to the epersongroup table and its name to the metadatavalue table.

INSERT INTO epersongroup (eperson_group_id) VALUES (nextval('epersongroup_seq'));

INSERT INTO metadatavalue (metadata_field_id, resource_type_id, resource_id, text_value) VALUES (
  (SELECT metadata_field_id
    FROM metadatafieldregistry
    WHERE metadata_schema_id = 1
    AND element = 'title'
    AND qualifier IS NULL
  ),
  6,
  currval('epersongroup_seq'),
  'NEW_GROUP_NAME'
);

Lluís Madurell Alemany

unread,
Nov 4, 2016, 8:46:57 AM11/4/16
to DSpace Technical Support, vegard....@usit.uio.no, dspac...@lists.sourceforge.net, hel...@centrum.sk
Hi.

I have the same case, I want all new users registered to automatically go to group 'Registered', I set my authentication.cfg
plugin.sequence.org.dspace.authenticate.AuthenticationMethod = \
        org
.dspace.authenticate.PasswordAuthentication



And my authentication-password.cfg
login.specialgroup = Registered
digestAlgorithm
= SHA-512

I understand that groups are dinamic according if the user is logged in or not.
But I get this log message all the time I try myself with my mail adress to create new accounts.

2016-11-04 13:10:28,733 WARN  org.dspace.authenticate.PasswordAuthentication @ xxx@xxx.xxx::password_specialgroup:Group defined in modules/authentication-password.cfg login.specialgroup does not exist


And I can see my group in the web manager.

Can be done without LDAP?

El dimecres, 26 agost de 2015 20:32:07 UTC+2, helix84 va escriure:
Reply all
Reply to author
Forward
0 new messages