Beispiel #1
0
        public ICollection <sys_server_role_member> GetServerRoleMembers(sys_server_principal principal)
        {
            using (var cnn = Connection())
                return(cnn.Query <sys_server_role_member>(@"
SELECT role_principal_id, member_principal_id
FROM sys_server_role_member
WHERE role_principal_id = @principal_id", new { principal.principal_id }).ToList());
        }
Beispiel #2
0
        public ICollection <sys_server_permission> GetServerPermissions(sys_server_principal principal)
        {
            using (var cnn = Connection())
                return(cnn.Query <sys_server_permission>(@"
SELECT class, grantee_principal_id, grantor_principal_id, type, state
FROM sys_server_permission
WHERE grantee_principal_id = @principal_id", new { principal.principal_id }).ToList());
        }
Beispiel #3
0
        public bool SaveServerPrincipal(sys_server_principal principal)
        {
            using (var cnn = Connection())
                return(principal.principal_id == 0
                    ? (principal.principal_id = (int)cnn.Query <long>(@"
INSERT INTO sys_server_principal (name, sid, type, is_disabled, default_database_name, default_language_name)
VALUES (@name, @sid, @type, @is_disabled, @default_database_name, @default_language_name);
SELECT last_insert_rowid();", principal).First()) != 0
                    : cnn.Query <int>(@"
UPDATE sys_server_principal
SET name = @name, sid = @sid, type = @type, is_disabled = @is_disabled, modify_date = datetime(), default_database_name = @default_database_name, default_language_name = @default_language_name
WHERE principal_id = @principal_id;
SELECT changes();", principal).First() != 0);
        }