Toad World® Forums

Setting grantor of permissions

Hi. I originally posted this as a reply to an older post but it didn’t receive any replies http://modeling.inside.quest.com/thread.jspa?threadID=30232&tstart=0, but I thought it might be better as a post on it’s own since it was not directly related to the original thread but more of an addition.

How do you then set the grantor in a permission using a script? I have looked at the reference guide and as far as I can tell the following should work but the grantor is appearing as “-- None --”

function main() {
var app = System.GetInterface(‘Application’);
var Model = app.Models.GetObject(0);
var LoadWarehouseRole = Model.UserGroups.GetObjectByName(‘LOAD_WAREHOUSE’);
var FactOwner = Model.Users.GetObjectByName(‘MCN_DATA’); //THIS IS WHO WILL BE THE GRANTOR

Model.Lock();
for (e=0; e
Entity = Model.Entities.GetObject(e);
Model.AddUserRight(Entity, LoadWarehouseRole, ‘INSERT’,‘Grant’,FactOwner);
Model.AddUserRight(Entity, LoadWarehouseRole, ‘UPDATE’,‘Grant’,FactOwner);
}
Model.UnLock();
}