public List<string> Handle(ActivityAuth auth) { List<string> result = new List<string>(); ISqlMapper mapper = Common.GetMapperFromSession(); UserBLL bll = new UserBLL(); string userid = bll.GetCurrentUser().User.ID; //string userid = "16"; RoleDao roledao = new RoleDao(mapper); User_RoleDao urdao = new User_RoleDao(mapper); string[] roleids = auth.Value.Split(','); var subroles = roledao.Query(new RoleQueryForm { ParentIDs = roleids.ToList() }); var urs = urdao.Query(new User_RoleQueryForm { UserID = userid }); var roles = subroles.FindAll(t => urs.Exists(p => p.RoleID == t.ID)); if (roles == null || roles.Count == 0) { result.Add(userid); } else { IWorkflowAuthorityHandler handler = new RoleWorkflowAuthorityHandler(); foreach (var role in roles) { if (roleids.Any(t => t == role.ParentID)) { result.AddRange(handler.Handle(new ActivityAuth { Value = role.ParentID, })); } } } return result; }
public List<string> Handle(ActivityAuth auth) { //var user = userbll.GetCurrentUser(); //string userid = user.User.ID; string userid = "13"; UserleaderWorkflowAuthority authority = new UserleaderWorkflowAuthority(); return authority.GetUserIDs(userid, Convert.ToInt32(auth.Value)); }
public List<string> Handle(ActivityAuth auth) { ISqlMapper mapper = Common.GetMapperFromSession(); WorkflowDao dao = new WorkflowDao(mapper); Workflow wf = dao.Query(new WorkflowQueryForm { ID = auth.WorkflowID }).FirstOrDefault(); string userid = wf.Creator; UserleaderWorkflowAuthority authority = new UserleaderWorkflowAuthority(); return authority.GetUserIDs(userid, Convert.ToInt32(auth.Value)); }
public List<string> Handle(ActivityAuth auth) { ISqlMapper mapper = Common.GetMapperFromSession(); RoleDao roledao = new RoleDao(mapper); User_RoleDao urdao = new User_RoleDao(mapper); List<string> result = new List<string>(); var role = roledao.Query(new RoleQueryForm { ID = auth.Value, IsDeleted = 0 }).FirstOrDefault(); if (role != null) { var userrole = urdao.Query(new User_RoleQueryForm { RoleID = role.ID }); if (userrole != null) { foreach (var ur in userrole) { if (!result.Contains(ur.UserID)) { result.Add(ur.UserID); } } } } return result; }
private void button19_Click(object sender, EventArgs e) { WorkflowAuthority wf = new WorkflowAuthority(); var au = new ActivityAuth { Type = "role", Value = "7,14", }; var list = wf.GetUserIDList(new List<ActivityAuth> { au }); LeaderInRoleWorkflowAuthorityHandler handler = new LeaderInRoleWorkflowAuthorityHandler(); list = handler.Handle(au); }