예제 #1
0
        public EntityFrameworkCore.Data.Role CreateRole(AuthorizationsTestContext context, string roleName)
        {
            var role = new EntityFrameworkCore.Data.Role
            {
                Name           = roleName,
                CreationBy     = context.CurrentUserId,
                ModificationBy = context.CurrentUserId
            };

            context.Roles().Add(role);

            return(role);
        }
예제 #2
0
        protected EntityFrameworkCore.Data.Authorization CreateAuthorization(AuthorizationsTestContext context, Guid principalId, EntityFrameworkCore.Data.Role role, EntityFrameworkCore.Data.Scope scope)
        {
            var authorization = new EntityFrameworkCore.Data.Authorization
            {
                PrincipalId    = principalId,
                Role           = role,
                Scope          = scope,
                CreationBy     = context.CurrentUserId,
                ModificationBy = context.CurrentUserId
            };

            context.Authorizations().Add(authorization);

            return(authorization);
        }
예제 #3
0
        protected EntityFrameworkCore.Data.RoleRight AddRightToRole(AuthorizationsTestContext context, EntityFrameworkCore.Data.Right right, EntityFrameworkCore.Data.Role role)
        {
            var roleRight = new EntityFrameworkCore.Data.RoleRight
            {
                Right = right,
                Role  = role
            };

            context.RoleRights().Add(roleRight);

            return(roleRight);
        }