ICAT 4.1 API - addUserGroupMember, addRule

19 views
Skip to first unread message

c.felder.m.sc

unread,
Jul 5, 2012, 6:29:20 AM7/5/12
to icatproje...@googlegroups.com
Hello,

is there some PDF document (as provided for ICAT 4.0) or other documentation for ICAT 4.1?
In the previous version I have used the addUserGroupMember and addRule methods to create the
necessary permissions to deal with the web service.

example code (ICAT 4.0), self._c is an derived instance of suds.client.Client:

        # create group root and add user root

        self._c.service.addUserGroupMember(self._sessionId, "root", "root")

        # root should have access to all types

        for icatType in ICatType.ALL_TYPES:

            self._c.service.addRule(self._sessionId, "root", icatType, 

                                    "CRUD", None)


How do I accomplish this with the new API?

I think I have to create a ?group? or ?userGroup? first and then a new rule using the factory.

But I don't understand the relationship because rule references group and group references rules[].


I ran into Unexpected DB responses when I finally call the webservices create method.


Best,

Christian

c.felder.m.sc

unread,
Jul 5, 2012, 9:06:54 AM7/5/12
to icatproje...@googlegroups.com
I resolved the problem my self.
The following first version of code does what I expect:

        # create group root

        group = self._c.factory.create("group")

        group.name = "root"

        group.id = self._c.service.create(self._sessionId, group)

        # root should have access to all types

        for icatType in ICatType.ALL_TYPES:

            rule = self._c.factory.create("rule")

            rule.group = group

            rule.crudFlags = "CRUD"

            rule.what = icatType

            self._c.service.create(self._sessionId, rule)


        # create User and UserGroup to represent

        # user -> group relationship

        usr = self._c.factory.create("user")

        usr.name = "root"

        usr.fullName = "Superuser"

        usr.id = self._c.service.create(self._sessionId, usr)

        

        # relationship

        usrGroup = self._c.factory.create("userGroup")

        usrGroup.group = group

        usrGroup.user = usr

        self._c.service.create(self._sessionId, usrGroup)

Steve Fisher

unread,
Jul 5, 2012, 1:27:37 PM7/5/12
to icatproje...@googlegroups.com
Sorry for the delay replying - I have not been at work today. The
documentation is all below
http://www.icatproject.org/mvn/site/icat/4.1.0. At the top left of
this page are all the links to user documentation including the schema
and using the Java client.

On 5 July 2012 14:06, c.felder.m.sc <c.feld...@gmail.com> wrote:
> I resolved the problem my self.

Good!

Steve
> --
> You received this message because you are subscribed to the Google Groups
> "icatproject-support" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/icatproject-support/-/GjLksIfV81oJ.
>
> To post to this group, send email to icatproje...@googlegroups.com.
> To unsubscribe from this group, send email to
> icatproject-sup...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/icatproject-support?hl=en.
Reply all
Reply to author
Forward
0 new messages