namedgroup.java

来自「JSPWiki,100%Java开发的一套完整WIKI程序」· Java 代码 · 共 41 行

JAVA
41
字号
package com.ecyrd.jspwiki.auth;import com.ecyrd.jspwiki.InternalWikiException;import java.security.Principal;/** *  A special kind of WikiGroup.  Anyone who has set their name in *  the cookie is a part of this group. */public class NamedGroup    extends AllGroup{    public NamedGroup()    {        setName( UserManager.GROUP_NAMEDGUEST );    }    public boolean isMember( Principal user )    {        if( user instanceof UserProfile )        {            UserProfile p = (UserProfile) user;            return p.getLoginStatus() >= UserProfile.COOKIE;        }        else if( user instanceof WikiGroup )        {            WikiGroup wg = (WikiGroup) user;            return equals( wg );        }        throw new InternalWikiException("Someone offered us a Principal that is not an UserProfile!");    }    public boolean equals( Object o )    {        return o != null && o instanceof NamedGroup;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?