コード例 #1
0
ファイル: Authorizer.cs プロジェクト: priaonehaha/prontocms
        public void AddAdmin(string id, string name, string token)
        {
            if (id == null) throw new ArgumentNullException("id");
            name = (name ?? "").Trim();
            if (name.Length == 0) throw new Exception("Please enter your name.");
            if (IsUserAdmin(id)) throw new Exception("The admin user " + name + "(" + id + ") already exists.");
            if (!tokens.Remove(token)) throw new Exception("Invalid sign-up number.");

            var admin = new Admin { Id = id, Name = name };
            admins.Add(admin);
        }
コード例 #2
0
ファイル: Authorizer.cs プロジェクト: priaonehaha/prontocms
        public void AddAdmin(string id, string name)
        {
            if (id == null) throw new ArgumentNullException("id");
            name = (name ?? "").Trim();
            if (name.Length == 0) throw new Exception("Please enter your name.");
            if (IsUserAdmin(id)) throw new Exception("The admin user " + name + "(" + id + ") already exists.");
            if (admins.Count > 0) throw new Exception("Already added first admin user.");

            var admin = new Admin { Id = id, Name = name };

            admins.Add(admin);
        }