[Rt-devel] ERM db schema and relationship with codes for disable an user

Raed El-Hames rfh at vialtus.com
Wed Feb 10 05:18:00 EST 2010


Eduardo;

Assuming a user does not belong to a group, there will be 4 entries for 
it in the database:
1- A row in the Users table (name,email address, etc etc)
2- A row in the Groups table eg for a user with Users.id = 101
+-----+----------+-------------------------+----------------+-----------+----------+
| id  | Name     | Description             | Domain         | Type      
| Instance |
+-----+----------+-------------------------+----------------+-----------+----------+
| 102| User 101 | ACL equiv. for user 101 | ACLEquivalence | UserEquiv 
|      101 |
+-----+----------+-------------------------+----------------+-----------+----------+
3- 2 rows in the Principals table
+-----+---------------+----------+----------+
| id  | PrincipalType | ObjectId | Disabled |
+-----+---------------+----------+----------+
| 101 | User          |      101 |        0 |
+-----+---------------+----------+----------+
+-----+---------------+----------+----------+
| id  | PrincipalType | ObjectId | Disabled |
+-----+---------------+----------+----------+
| 102 | Group         |      102 |        0 |
+-----+---------------+----------+----------+

Disabling a user, will set the Disabled field to 1, for both Principals 
rows 101 and 102

Bare in mind tinkering in the database is not recommended , and as far 
as I know, later versions of RT include a Shredder which allow you to 
clean the database.

Hope that helped;

Regards;
Roy





Eduardo Cerqueira wrote:
> I'd like to understand the DB relationship. would we have the ERM or 
> DB schema in some place on twiki? I took a glace there but with no 
> successful.
>
> at this point I want to clean up old users from my DB (I have 265 
> records) in my Users table and I am not sure how can I filter users 
> disabled as into table there is no
> flag field for this, at least I didn't find this.
>
> and I really would love to understand where is going Disabled value, 
> for this case below I copied it from 
> rt3/share/html/Admin/Users/Modify.html so I can't see this field in 
> Users table.
>
> */can my DB schema is no updated?/*
>
>
>     if ( defined $id && $id eq 'new') {
> ( $val, $msg ) = $UserObj->Create(
>     Name                  => $Name,
>     EmailAddress          => $ARGS{'EmailAddress'},
>     Name                  => $ARGS{'Name'},
>     Comments              => $ARGS{'Comments'},
>     Signature             => $ARGS{'Signature'},
>     EmailAddress          => $ARGS{'EmailAddress'},
>     FreeformContactInfo   => $ARGS{'FreeformContactInfo'},
>     Organization          => $ARGS{'Organization'},
>     RealName              => $ARGS{'RealName'},
>     NickName              => $ARGS{'NickName'},
>     Lang                  => $ARGS{'Lang'},
>     EmailEncoding         => $ARGS{'EmailEncoding'},
>     WebEncoding           => $ARGS{'WebEncoding'},
>     ExternalContactInfoId => $ARGS{'ExternalContactInfoId'},
>     ContactInfoSystem     => $ARGS{'ContactInfoSystem'},
>     Gecos                 => $ARGS{'Gecos'},
>     ExternalAuthId        => $ARGS{'ExternalAuthId'},
>     AuthSystem            => $ARGS{'AuthSystem'},
>     HomePhone             => $ARGS{'HomePhone'},
>     WorkPhone             => $ARGS{'WorkPhone'},
>     MobilePhone           => $ARGS{'MobilePhone'},
>     PagerPhone            => $ARGS{'PagerPhone'},
>     Address1              => $ARGS{'Address1'},
>     Address2              => $ARGS{'Address2'},
>     City                  => $ARGS{'City'},
>     State                 => $ARGS{'State'},
>     Zip                   => $ARGS{'Zip'},
>     Country               => $ARGS{'Country'},
>     Privileged           => $ARGS{'Privileged'},
>     Disabled            => ($ARGS{'Enabled'} ? 0 : 1)
> );
>
>
> I really appreciate for your help.
>
> Thanks,
> Eduardo 


More information about the Rt-devel mailing list