Пример #1
0
 public static IAccessStatement GenerateBaseGrant(
     string database,
     int objectType,
     long permissionMask,
     string parentName,
     string objectName,
     phPrincipal principal,
     string statement)
 {
     return GenerateBaseGrant(database, SqlPermission.GetPermission(objectType, permissionMask), parentName, objectName,
                                     principal, statement);
 }
Пример #2
0
 internal void AddPrincipal(phPrincipal principal)
 {
     if (!this.principals.Contains(principal))
     {
         this.principals.Add(principal);
     }
 }
Пример #3
0
        public static IAccessStatement GenerateBaseGrant(
            string database,
            SqlPermission permission,
            string parentName,
            string objectName,
            phPrincipal principal,
            string statement)
        {
            var gas = new GenericAccessStatement
                {
                    // GRANT
                    AccessType = AccessType.Grant,
                    // Database name
                    Database = database,
                    // On a specific object
                    SecurableObject = String.IsNullOrWhiteSpace(objectName) ? null : new SecurableObject
                    {
                        Type = permission.PermissionClass,
                        Database = database,
                        ObjectOwner = parentName,
                        ObjectName = objectName
                    }
                };

            // A set of permissions
            gas.AddPermission(permission);

            // To a set of users
            gas.AddPrincipal(principal);

            // Additional meta-data
            gas.AddStatement(statement);

            return gas;
        }