示例#1
0
        public static RoleInPath CreateOrUpdateRolePath(string app, string role, string url)
        {
            if (string.IsNullOrEmpty(app)) app = "/";

            var dc = DCFactory.GetDataContext<SecurityDataContext>();
            var path = GetSitePath(url);
            if (path == null)
            {
                throw new Exception("Sitemap path does not exist!");
            }

            var rp = GetRolePath(app, role, url);
            if (rp == null) rp = new RoleInPath();
            rp.ApplicationName = app.Trim();
            rp.RoleName = role;
            rp.PathId = path.PathId;
            //if (!exist)
            dc.RoleInPaths.InsertOnSubmit(rp);

            return rp;
        }
 private void detach_RoleInPaths(RoleInPath entity)
 {
     this.SendPropertyChanging();
     entity.SiteMap = null;
 }