Im trying to generate user permissions by script in Toad Data Modeller 5.3.
It works fine with simple permissions (i.e. Model.AddUserRight(Entity, User, ‘SELECT’, ‘Grant’)
But, how do I set complex permissions with “grant option”?
I tried to create a DbRight via Model.CreateNewObject(1014) but got an Internal Error (Access Violation).
Hello there,
Try using the following code:
function main(){
var Ent = Model.Entities.GetObject(0); //Gets first entity in Model, use GetObjectByName() instead if needed
var User = Model.Users.GetObject(0); //Gets first user in Model, use GetObjectByName() instead if needed
var IUGRelation = Model.AddUserRight(Ent, User, 'SELECT', 'Grant'); //Object that contains Entity, User, and Rights
var Right = IUGRelation.Rights.GetObjectByName('GrantSELECT');
Right.GrantOption = true;
}
The result in a very simple model:
Regards,
Lukas