Exemple #1
0
 //---------------------------------------------------------------------------------
 public static void InitSiteAdmin( int appId )
 {
     AppAdminRole admin = new AppAdminRole();
     admin.AppId = appId;
     admin.RoleId = SiteRole.Administrator.Id;
     admin.insert();
 }
Exemple #2
0
        public static void DeleteAll()
        {
            IList allAppRoles = new AppAdminRole().findAll();

            foreach (AppAdminRole ar in allAppRoles) {
                ar.delete();
            }
        }
Exemple #3
0
        //---------------------------------------------------------------------------------


        public static void InitSiteAdmin(int appId)
        {
            AppAdminRole admin = new AppAdminRole();

            admin.AppId  = appId;
            admin.RoleId = SiteRole.Administrator.Id;
            admin.insert();
        }
Exemple #4
0
        public static Boolean IsRoleInApp( int roleId, int appId )
        {
            IList configAll = new AppAdminRole().findAll();
            foreach (AppAdminRole ac in configAll) {

                if (ac.AppId == appId && ac.RoleId == roleId) return true;
            }
            return false;
        }
Exemple #5
0
        public static void DeleteAll()
        {
            IList allAppRoles = new AppAdminRole().findAll();

            foreach (AppAdminRole ar in allAppRoles)
            {
                ar.delete();
            }
        }
Exemple #6
0
        public static Boolean IsRoleInApp(int roleId, int appId)
        {
            IList configAll = new AppAdminRole().findAll();

            foreach (AppAdminRole ac in configAll)
            {
                if (ac.AppId == appId && ac.RoleId == roleId)
                {
                    return(true);
                }
            }
            return(false);
        }
        public void SaveAppAdminRole()
        {
            String appRoles = ctx.Post( "appRole" );
            AppAdminRole.DeleteAll();

            if (strUtil.HasText( appRoles )) {

                string[] values = appRoles.Split( ',' );
                foreach (String str in values) {

                    if (strUtil.IsNullOrEmpty( str )) continue;
                    string[] arrItem = str.Split( '_' );
                    if (arrItem.Length != 2) continue;

                    int appId = cvt.ToInt( arrItem[0] );
                    int roleId = cvt.ToInt( arrItem[1] );
                    if (appId <= 0 || roleId <= 0) continue;

                    AppAdminRole ar = new AppAdminRole();
                    ar.AppId = appId;
                    ar.RoleId = roleId;
                    ar.insert();
                }
            }

            log( SiteLogString.UpdateAppAdminPermission(), typeof( AppAdminRole ) );

            echoRedirect( lang( "saved" ) );
        }