Exemplo n.º 1
0
		public OP.RoleCollection GetUserRoles(OP.IApplication application, OP.IUser user)
		{
			bool includeDeleted = Util.GetContextIncludeDeleted();
			//var allRoles = GetRoles(application);
			var roles = PC.Adapters.SCSnapshotAdapter.Instance.QueryUserBelongToRoles(PC.SchemaInfo.FilterByCategory("Roles").ToSchemaNames(), application.CodeName, new string[] { user.ID }, false, DateTime.MinValue);
			////var relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryUserBelongToContainersByIDs(new string[] { "Roles" }, new string[] { user.ID }, includeDeleted, DateTime.MinValue);

			//return new OP.RoleCollection((from role in allRoles join r in relations on role.ID equals r.ID select role).ToArray());
			return new OP.RoleCollection((from role in roles select this.CastRole(role, application)).ToArray());
		}
Exemplo n.º 2
0
		public OP.PermissionCollection GetUserPermissions(OP.IApplication application, OP.IUser user)
		{
			//var allFuns = InnerGetPermission(application);

			//var allFunIds = allFuns.ToIDArray();

			bool includeDeleted = Util.GetContextIncludeDeleted();

			var appPermission = application.Permissions;

			var userAllPermissions = PC.Adapters.SCSnapshotAdapter.Instance.QueryPermissionsByUserIDs(new string[] { user.ID }, includeDeleted, DateTime.MinValue);

			return new OP.PermissionCollection((from p in userAllPermissions join appp in appPermission on p.ID equals appp.ID select this.CastPermission(p, application)).ToArray());
		}