How to achieve logical operator on [Authorize(Roles = ] in MVC

For example, I need to make a controller accessible a user with two roles; role "Admin" and "Editor". How to achieve it.
   [Authorize(Roles = "Admins")]
    public class SampleController : BaseController
How to do logical operator, such as AND and OR (maybe || and &&)
Thanks!
  

Hello klouapple,
Please post your question to ASP.NET forum instead of here.
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to store logical operator in an array in java

    how to store logical operator in an array in java.
    Array should not be String type if i pass an element of that array it should be considered as logical operator

    my exact requirment is like this, i need some logic
    to convert string like this "2 Equals 3 AND 4 greater
    than 7" to condition like this
    2 == 3 && 4 >7 which i can pass to if
    condition.So you want to create an expression parser?
    No need for something as ugly as what you think you need, a simple nested conditional will do it for just the few logical operations.

  • How to change logical operator

    Hi
    I am trying to determine Employee Responsible(ER) based on territory attributes. Determination should work on 4 attributes as Country,Region,Postal Code and Prod cat. But i could find that first 3 attributes(Country,Region,Postal Code) are grouped together by "And" operator but Prod cat is by"OR" operator.
    So in a way for correctly determined ER based in this order Prod Cat.,Cty,REGN,PCDE. How we can chnage the logical operator or grp togther these attribute so they are connected by "and" operator and as a set is evaluated in transaction to determine the correct Employee Responsible when prod. is entered.
    thanks
    chap

    Hello ,
    We too are facing the same problem of using the logical operator.
    We want to use ' "Country" AND "Product Hier/Cat" '  but can only use OR instead.
    Please advice.
    Rgds,
    Ak-

  • How to use logical operator

    Hi ,
    I hava a problem while using logical operators.
    I wrote a procedure to compare two strings.please check the following.
    CREATE OR REPLACE PROCEDURE comp_str(sour_str IN varchar2,targ_str IN varchar2) AS
    leng_sour_str number:=NVL(length(sour_str),0);
    leng_targ_str number:=NVL(length(targ_str),0);
    leng_str number:=NULL;
    BEGIN
    IF sour_str IS NULL THEN
    dbms_output.put_line(leng_targ_str);
    elsif targ_str IS NULL THEN
         dbms_output.put_line(leng_sour_str);
    ELSE
         select utl_match.edit_distance(leng_sour_str,leng_targ_str) into leng_str from dual;
    END IF;
    dbms_output.put_line(leng_str);
    IF (leng_str > 0) OR (leng_sour_str > 0) OR (leng_targ_str > 0) THEN
    dbms_output.put_line('Strings are not same');
    ELSE
    dbms_output.put_line('Strings are same');
    END IF;     
    END comp_str;
    IF (leng_str > 0) OR (leng_sour_str > 0) OR (leng_targ_str > 0) statement is not verifying the conditions properly.
    Please suggest me that how to write multiple conditions with OR Operator or any alternative.
    thanks in advance.

    They are working exactly as you expect it. The problem in your code is probably the "utl_match.edit_distance"-procedure. Do you know the outcome of this procedure?
    Why don't you try something like
    declare
      l_string1   varchar2(255) := 'String1';
      l_string2   varchar2(255) := 'String 2';
    begin
      if length(l_string1) > length(l_string2) then
        dbms_output.put_line('String 1 is longer than String 2');
      else
        dbms_output.put_line('String 1 is shorter than String 2');
      end if;
    end;This way, you can change one string or the other and see, how it works. With utl_match.edit_distance you need to know what exactly they are computing to see what the logical comparison is doing.

  • How to use logical operator in struts logic:equal

    Hi All,
    I need to translate:
    if ( a == 'option1' || a == 'option2' )
    to struts code....
    I don't know how to put || or && in <logic:equal.... ?&#65533;?&#65533;?&#65533;?
    Many thanks

    Must it really be Struts? If so, try asking this question at their own forum/mailinglist at apache.org.
    Can it be JSP? If so:${a == 'option1' || a == 'option2' ? 'outputThis' : 'outputElse'}Can it be JSTL? If so:<c:if test="${a == 'option1' || a == 'option2'}">
        <!-- Do your thing. -->
    </c:if>And please don't mark threads as answered if the question is not answered. I almost ignored this thread.

  • How to achieve modulus operation in infopath 2013

    Hi,
    My difference field calculates difference between the start date of the Employee and today's date and the result is in number of days. 
    To convert it to months i divide the result by 30. But get a weird number when divident is in single digit. 
    Can we have a modulus kind of operation in Infopath ?
    thank you.

    Hi, Victoria,
    Many thanks for your response. 
    I tried to use the approach suggested by Teylyn in the blog, but it didn't work for me. I wanted to calculate the difference between the two dates and referred to this blog: 
    http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm 
    I could get the difference in days, but i wanted to convert it in months so i thought i could divide it by 30 using modulus operation. I tried what was suggested in the blog on the difference field, but didn't work. The result was something like -0.234789065748E-1. 
    So i'm currently doing a round() operation of the [difference / 30] in Infopath form and with the help of rules, if the difference is >29 i divide the difference by 30 and take round figure and append months as suffix and if difference is < =29, the
    difference is given as is and i suffix days ahead of that.
    The above solution suggested by Teylyn may be correct in other cases. I couldn't test if it works for other scenarios. If it does, kindly mark it as answer. I will try to test it for other scenarios in the meantime.
    Thanks again. 
    Best Regards,
    Prajk

  • How to use varaible in place of logical operator in query

    Hi Experts,
    How can we use a variable in place of logical operator (OR, AND) ?
    For ex:
    select * from sflight where carrid = 'LH' AND connid = 100.
    data x type string.
    x = 'AND'.
    Now, I want to replace AND with the variable x.
    Query will be:
    select * from sflight where carrid = 'LH'  x connid = 100.
    I am doing this because user can select any logical operator while creating the search criteria at run time .
    I already tried this but i am getting following compilation error:
    Error: Incorrect expression used in place of logical expression.

    hi,
    Check out this sample code
    Display of flight connections after input of airline and flight number:
    PARAMETERS: carr_id TYPE spfli-carrid,
                conn_id TYPE spfli-connid.
    DATA:       where_clause TYPE  STRING,
                and(4),
                wa_spfli TYPE spfli.
    IF carr_id IS NOT INITIAL.
      CONCATENATE 'CARRID = ''' carr_id '''' INTO where_clause.
      and = ' AND'.
    ENDIF.
    IF conn_id IS NOT INITIAL.
      CONCATENATE where_clause and ' CONNID = ''' conn_id ''''
        INTO where_clause.
    ENDIF.
    SELECT * FROM spfli INTO wa_spfli WHERE (where_clause).
      WRITE: / wa_spfli-carrid, wa_spfli-connid, wa_spfli-cityfrom,
               wa_spfli-cityto, wa_spfli-deptime.
    ENDSELECT.
    Regards,
    Santosh

  • How to create authorization role for just displaying query prefix Q and X.

    Hi Expert,
    I hope someone can help me on how to create authorization role for just displaying and executing  BEX  Queries prefix Q and X. I'm currently using SAP BI 7.1.
    Actually, I already created one role called : Z_FORINDO_ONLYDISPLAY_QX
    where I only put in the Authorization Component (in the Role Maintenance - Tcode 'pfcg'):
    -->Manually Business Information Warehouse
        --> Manually Business Explorer - Components
    Activity : Display, Execute, Enter, Include, Assign
    InfoArea : *
    InfoCube : *
    Name(ID) of a reporting component : *
    Type of a reporting component : Calculated key figure, Restricted key figure, Template structure
        --> Manually Business Explorer - Components
    Activity : Display, Execute
    InfoArea : *
    InfoCube : *
    Name(ID) of a reporting component : Q* , X*
    Type of a reporting component : Query
    But, the problem is I still can make changes on that queries (Q* and X*). Even, I still can run query with prefix Z. I use S_RS_RREPU Tamplete for Query Display and execution.
    Please assist. Very much appreciate your help. Thanks.
    Edited by: nadiyah salleh on Mar 18, 2008 11:22 AM

    Question close. This issue has been resolved.

  • I recently changed my computer and cloned my hard drive. Logic won't authorize keeps asking me to re-submit my license.How do I authorize my new computer?

    Logic won't authorize keeps asking me to re-submit my license.How do I authorize my new computer? When logic opens up it doesnt show that it is licesned to me! Does anyone have any thoughts what to do? Thanks    Justin

    Ahh-llahhn,
    you’ll need to make a backup of your MacBook Pro, erase its internal disk, and reïnstall from scratch to associate your MacBook Pro with a new Apple ID.

  • How to achieve restriction for a single user having multiple authorization

    Hi,
    I have a requirement that an user has 4 authorizations attached to him.
    Auth1:
    0REGION: US, INDIA,JAPAN
    0PRODUCT: SHAMPOO
    Auth2:
    0REGION: US
    0PRODUCT:SOAP
    Auth3:
    0REGION: *
    0PRODUCT: DETERGENT
    Auth4:
    0REGION: ASIA
    0PRODUCT: *
    Now, this user when execute a report, then the report should pop up which authorization to choose and display the data accordingly on the specific input. For example.... if the user enters auth1, then PRODUCT SHAMPOO for REGION US,INDIA and JAPAN will be displayed.
    Please help how to achieve this.

    Hi
    You can try out following things
    Create a Info object for Authorization and include it in infocube on which query is based. Keep authorization blank in the info cube.
    Maintain relation ship between Authorization Product and Region in DSO or Database table.
    Create characteristics variable for authorization infoobject, Product and Region. Selection screen variable for Autorization will be ready for user entry. Selection screen variable for Product and Region will be customer exits variable.
    In I_step = 2, populate variable values for Product and customer based on the user entry for authorizaton variable and clear values of authorization variable
    Kindly let me know incase further details required
    Best Regards
    Rohit

  • Custom Authorization Logic Using request.isUserInRole(role) in Weblogic 11g

    Dear All,
    I am using BlazeDS and its security feature LoginCommand to implement a secured endpoint in Weblogic 11g. Since BlazsDS's default implementation uses HTTP session but we do not want to use it, we would like to implement our own version of authentication and authorization. However we faced a problem on authorization part.
    For authentication, we use weblogic.security.services.Authentication.login(username, password), which returns correctly. For authorization, we try to use HttpServletRequest.isUserInRole(role) to determine whether a user belongs to a target role, but it returns false.
    When we trying to fix the problem, we add weblogic.servlet.security.ServletAuthentication.login(username, password, request, response) before weblogic.security.services.Authentication.login(username, password), which will add information on HTTP session. It makes the later authorization using HttpServletRequest.isUserInRole(role) return true.
    We want to know:
    1. How can we check if an account belongs to a target role without using HTTP session in web application?
    2. After we call Authentication.login(username, password), anything we need to do to log out for releasing any resource used?
    3. If request.isUserInRole(role) is the only possible way to check if an account belongs to a target role, how to check the reason why it returns false?
    And here is how we set up user, group and role:
    User (in WebLogic Admin Console) – demo_user with demo_grp
    Group (in WebLogic Admin Console) – demo_grp with patent demo_grp1
    Role (in weblogic-application.xml) – demo_role maps to demo_grp1
    We set nothing in web.xml as we want to use the security feature provide by BlazeDS to secure an endpoint at method level.
    Remarks:
    For Authorization in BlazeDS, what we have is the authenticated user's principal, and the required role of the calling method:
    public boolean doAuthorization(Principal principal, List roles);
    Thanks In Advance,
    Alex

    You gotta specify your child table recon-field in the process definition mappings as a Key Field. Refer OOTB AD connector and check:
    Process Definition -> AD User ->Reconciliation Field Mappings -> memberOf

  • How to upload authorization role & profile to PFCG

    I have downlaod the authorization role & profile from PFCG at client 100.
    How to upload the authorization role & profile to SAP client 200?

    check with ur basis guys once
    generally it will be dont by them check with them once

  • How to apply different Logical operations to N.of Signals

    Hello all,
    Please help me if anyone have idea about this.
    I have “N” number of signals. I want to apply different Logical operations for this.
    For Example:
          (((SigA >= 30 && SigB <=55) || (SigC = 42)) && (SigD > 45))
    ((((SigD >= 89.25 && SigF <=55.568) ||(SigG = 156.89)) && (SigA >= 45)) || ((SigF – Sig A) >25))
    Here Conditions will change every time. User can input different conditions (like Excel calculations). I need to check signals as per these type of conditions. Is there is any tool kits available in LabVIEW / we need to develop?
    Currently I’m thinking about string manipulations to extract the each condition . Once first condition is finished then check this results with next conditions (so on..)
    Munna

    Hi GerdW,
    After long time again I stated doing this task. Could you please help me in this.
    As per my snippet, at 1st making array based on given String. From that string I need to check where open & closed brackets are coming to do logical operations.
    For Example: (2 OR ((1 AND 2) OR 3))
    Index
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    String
    2
    O
    R
    1
    A
    N
    D
    2
    O
    R
    3
    Please give me any idea/sample VI for the same.
    Here, 1,2 & 3 are Indices of Boolean 2D Array.
    Munna

  • A quick question  of Logical Operator - NOT?

    I know that the logical operator for NOT is " ! " sign.
    But someone could please tell me how do I use the NOT operator in the below code.
    if (c instanceof JLabel) Thanks

    Before you use this, think long and hard if there's a better way to
    achieve your goal than wandering through all of a panel's
    components checking for those that aren't JLabels.
    import javax.swing.*;
    public class Not {
         public static void main(final String[] argv) {
              final JComponent panel = new JPanel();
              if (!(panel instanceof JLabel)) {
                   System.out.println("It works.");
    }

  • Authorization  -- Roles

    Hi All,
    We are moving our applicaiton from Oracle Forms to Apex. I am basically a forms developer and I didnt understand the authorization/roles in Apex.
    For eg in our database we have 2 roles app_lookup ( privs - insert,update, delete, select) and app_guest( privs select) . And we use the database authentication for forms. If we have 2 end users Super with role app_lookup and operator with role app_guest, and if I want to implement the database role, how can it be done in Apex.
    End user Super ( with all privs) need to update/delete/insert/select in apex
    End user Operator( with only priv select) need to select particular table/pages in apex.
    Could someone throw lights on how this can be done in Apex.
    thank you
    rajesh

    "user596620",
    You can go to your control panel and give us your real name, or at least something easier than "user596620".
    Why do I think Database Authentication is a dying trend?
    - LDAP directories were designed from the ground-up to store information like Authentication and Authorization data.
    - Almost every technology out there can use LDAP as an Authentication source.
    - There are only a few technologies that can use the DB for an authentication source. What if your users don't want to have a separate username / password for their APEX apps than their email account? You're out of luck.
    - Databases were never designed as user repositories. It's a square peg in a round hole.
    - Mixing data schemas and user accounts in a database is mess to maintain. It's often difficult to tell them apart. Which ones contain sensitive data, which ones are just users?
    - There are only a few attributes that you can store in a database "user". If you want to store phone, email, certificate, etc, you have to create your tables for it.
    - If end users have accounts in a database, it's that much easier for them to connect with third-party tools and start poking around.
    - There is no concept of delegated administration with a database. How do you give someone the ability to manage all users in a particular group?
    - Managing roles and privs for thousands of database user accounts is a nightmare. It's much easier in a web environment to assign select / execute privs to the account used by the web application, vs all of the users accessing the application.
    - Onboarding / off-boarding / auditing accounts scattered throughout a bunch of databases is impossible vs creating / deleting / auditing all accounts and groups (roles) in a single LDAP directory.
    I'm probably missing a lot of points here, so I may ask someone one the Identity Management side of things to chime-in.
    Tyler

Maybe you are looking for

  • HD 1080i to SD DVD (anamorphic)

    Hi there, I've searched around and have surprisingly not found anyone with this question: How do you go from 1080i to an anamorphic SD DVD? What I have done is the following: In FCP 5, create new sequence. There is not a sequence preset that offers 1

  • Itunes for leopard 10.5

    I have leopard 10.5.8. I tried to install the latest itunes. It wouldn't allow me to install the latest version. Reason: unknown error (11333)

  • Can't import photos from iPad

    When I plug in my iPad to my MacBook in iTunes it shows up as my iPad.  But when I open iPhoto to import the pictures on my iPad it tells me that the device that is plugged in is my iPhone and it won't let me import my photos.  Does anyone know what

  • BI Statistics: Cube 0TCT_C01: 0TCTQUCOUNT and 0TCTWTCOUNT

    I am no BW specialist so I am sorry if this question may seem somewhat strange. The InfoCube 0TCT_C01 contains among others these key figures: 0TCTQUCOUNT: This key figure contains the number of BI application objects (query, query view, and so on).

  • Upgrade to IOS 5 problems

    When I try to upgrade my iPad 64GB-3G to IOS 5 I face 2 major issues: 1)  I need to upgrade using the computer I sync with:      This computer is a Windows with limited C: drive (I use partitions to separate data/media from programs and OS), and it d