Date: Thu, 28 Mar 2024 19:02:02 +0000 (UTC) Message-ID: <2109236982.6821.1711652522134@ip-10-10-7-29.ec2.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_6820_1946869812.1711652522131" ------=_Part_6820_1946869812.1711652522131 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
GROUPER: About FAQ Software Documentation <= a href=3D"/display/Grouper/Archives">Archives Contribute WG Contact |
---|
This is an archived document. For the current version, please see = GrouperShell (gsh)=
GrouperShell (gsh) is a shell for administering and int= eracting with the Grouper API. It can be used in both a batch and interacti= ve manner.
This version of of GrouperShell is c= ompatible with Grouper v1.2.0.
% cd gr= ouper/contrib/gsh % ant
% ant t= est
Grouper must have a JDBCSourceAdapter for subjects for the test suite to= complete successfully. This need is adequately met by testing GrouperShell= using the same grouper/conf directory contents used to test the Grouper AP= I.
Note: In some environments the tests may fail due to a = bug exposed by the testing procedure which might not indicate any actual er= ror with the gsh utility itself. This is known to occur, for example, under= cygwin on Windows. An alternative testing process is to run each of the te= st suites, which are gsh scripts, individually as follows:
% bin/g= sh.sh src/test/test.gsh % bin/gsh.sh src/test/groups.gsh % bin/gsh.sh src/t= est/stems.gsh % bin/gsh.sh src/test/composites.gsh % bin/gsh.sh src/test/pr= ivs.gsh
% ant j= ar
% ant h= tml
% ./bin= /gsh.sh
% ant s= hell
% ./bin= /gsh.sh -
% ./bin= /gsh.sh /path/to/your/script.gsh
Command |
Description |
---|---|
addComposite(group, type, left group, right g= roup. |
Add composite membership. |
addGroup(parent, extension, displayExtension)= |
Add group beneath parent stem with the specif= ied extension and displayExtension. |
addMember(group, subject id) |
Add subject as a member to the group. |
addRootStem(extension, displayExtension) <= /td> | Add root stem with the specified extension an= d displayExtension. |
addStem(parent, extension, displayExtension)<= /p> |
Add stem beneath parent stem with the specifi= ed extension and displayExtension. |
addSubject(id, type, name) |
Add a HibernateSubject to the Groups Registry= . |
delComposite(group) |
Delete composite membership from the specifie= d group. |
delGroup(name) |
Delete group with the specified name. |
delMember(group, subject id) |
Remove subject as a member of the group. <= /td> |
delStem(name) |
Delete stem with the specified name. |
exit |
Terminate shell. |
findSubject(id) |
Find a subject. |
findSubject(id, type) |
Find a subject. |
findSubject(id, type, source) |
Find a subject. |
getGroupAttr(stem, attr) |
Get value of group's attr attribute. |
getGroups(name) |
Find all groups with name in any naming attri= bute value. |
getMembers(group) |
Get members of the group. |
getSources() |
Find all Subject sources. |
getStemAttr(stem, attr) |
Get value of stem's attr attribute. |
getStems(name) |
Find all stems with name in any naming attrib= ute value. |
grantPriv(name, subject id, privilege) | Grant privilege to subject id on name. pr=
ivilege must be an AccessPrivilege (e.g. |
groupAddType(group, type) |
Add group type type to group. |
groupDelType(group, type) |
Delete group type type from grou= p. |
groupGetTypes(group) |
Get group's group types. |
groupHasType(group, type) |
Check whether group has group type <= em>type. |
hasMember(group, subject id) |
Is subject a member of this group. |
hasPriv(name, subject id, privilege) |
Does subject id have privilege on name? p=
rivilege must be a n_AccessPrivilege_ (e.g. |
help() |
Display usage information. |
history() |
Print commands that have been run. |
history(N) |
Print the last N commands that have been run.= |
last() |
Run the last command executed. |
last(N) |
Execute command number N. |
p(command) |
Pretty print results. This command is more us= eful when GSH_DEVEL is enabled. |
quit |
Terminate shell. |
resetRegistry() |
Restore the Groups Registry to a default stat= e. |
revokePriv(name, subject id, privilege) = td> | Revoke privilege from subject id on name. privilege must be an AccessPrivilege (e.g. |
setGroupAttr(group, attr, value) |
Set value of group's attr a= ttribute. |
setStemAttr(stem, attr, value) |
Set value of stem's attr at= tribute. |
typeAdd(name) |
Create custom group named name. <= /td> |
typeAddAttr(type, name, read, write, required= ) |
Create a custom group attribute named nam=
e on group type type. read and write must b=
e an |
typeAddList(type, name, read, write) |
Create a custom membership list named nam=
e on group type type. read and write must b=
e an |
typeDel(name) |
Delete the group type named name. |
typeDelField(type, name) |
Delete the custom field named name f= rom group type type. |
typeFind(name) |
Find the group type named name = td> |
typeGetFields(name) |
Get the fields associated with the group type= named name. |
version() |
Return version information. |
xmlFromFile(filename) |
Load Groups Registry with XML contained in |
xmlFromString(xml) |
Load Groups Registry with XML in the xml<= /em> string. |
xmlFromURL(url) |
Load Groups Registry with XML located at = url. |
xmlToFile(filename) |
Exports Groups Registry to filename.= |
xmlToString() |
Exports Groups Registry to string. |
xmlUpdateFromFile(filename) |
Update Groups Registry with XML contained in = filename. |
xmlUpdateFromString(xml) |
Update Groups Registry with XML in the xm= l string. |
xmlUpdateFromURL(url) |
Update Groups Registry with XML located at |
In addition, any Grouper API method can be directly invoked just by refe= rencing it, inclusive of the class in which it is defined. And methods retu= rn a java object which can be stored in a variable. For example, the follow= ing gsh session determines all of the groups to which a given subject belon= gs:
gsh-0.0= .1 0% subj =3D findSubject("SD00125") subject: id=3D'SD00125' type=3D'perso= n' source=3D'kitn-person' name=3D'Barton, Tom' gsh-0.0.1 1% sess =3D Group= erSession.start(subj) edu.internet2.middleware.grouper.GrouperSession: 29c4= 0f97-9fb0-4e45-88bc-a14877a6c9b5,'SD00125','person' gsh-0.0.1 2% member = =3D MemberFinder.findBySubject(sess, subj) member: id=3D'SD00125' type=3D'p= erson' source=3D'kitn-person' uuid=3D'd0fa765e-1439-4701-89b1-9b08b4ce9daa'= gsh-0.0.1 3% member.getGroups() group: name=3D'etc:wheel' displayName=3D'= Grouper Administration:Wheel Group' uuid=3D'6f77fb36-b466-481a-84a7-7af609f= 1ad09'
Variable |
Description |
---|---|
GSH_DEBUG |
If set to true, stack traces will be printed = upon failure. |
GSH_DEVEL |
If set to true, summaries of returned objects= are not automatically printed. |
GSH_TIMER |
If set to true, the time taken to evaluate ea= ch command will be displayed. |
Example:
gsh-0.0= .1 4% GSH_DEVEL =3D true gsh-0.0.1 5% subj =3D findSubject("SD00125") gsh= -0.0.1 6% sess =3D GrouperSession.start(subj) gsh-0.0.1 7% member =3D Memb= erFinder.findBySubject(sess, subj) gsh-0.0.1 8% p(member.getGroups()) grou= p: name=3D'etc:wheel' displayName=3D'Grouper Administration:Wheel Group' uu= id=3D'6f77fb36-b466-481a-84a7-7af609f1ad09'
Questions or comments? Contact us.
GROUPER: About FAQ Software Documentation&n= bsp; Archives Contribute WG Contact |
---|